Programming Geek
Rated 4.7/5 based on 1446 reviews

CodeVita 2017 Question: Chakravyuha

Problem: Chakravyuha

During the battle of Mahabharat, when Arjuna was far away in the battlefield, Guru Drona made a Chakravyuha formation of the Kaurava army to capture Yudhisthir Maharaj. Abhimanyu, young son of Arjuna was the only one amongst the remaining Pandava army who knew how to crack the Chakravyuha. He took it upon himself to take the battle to the enemies.

Abhimanyu knew how to get power points when cracking the Chakravyuha. So great was his prowess that rest of the Pandava army could not keep pace with his advances. Worried at the rest of the army falling behind, Yudhisthir Maharaj needs your help to track of Abhimanyu's advances. Write a program that tracks how many power points Abhimanyu has collected and also uncover his trail 

A Chakravyuha is a wheel-like formation. Pictorially it is depicted as below 

A Chakravyuha has a very well-defined co-ordinate system. Each point on the co-ordinate system is manned by a certain unit of the army. The Commander-In-Chief is always located at the center of the army to better co-ordinate his forces. The only way to crack the Chakravyuha is to defeat the units in sequential order.

A Sequential order of units differs structurally based on the radius of the Chakra. The radius can be thought of as length or breadth of the matrix depicted above. The structure i.e. placement of units in sequential order is as shown below

The entry point of the Chakravyuha is always at the (0,0) co-ordinate of the matrix above. This is where the 1st army unit guards. From (0,0) i.e. 1st unit Abhimanyu has to march towards the center at (2,2) where the 25th i.e. the last of the enemy army unit guards. Remember that he has to proceed by destroying the units in sequential fashion. After destroying the first unit, Abhimanyu gets a power point. Thereafter, he gets one after destroying army units which are multiples of 11. You should also be a in a position to tell Yudhisthir Maharaj the location at which Abhimanyu collected his power points.

Input Format: First line of input will be length as well as breadth of the army units, say N

Output Format: 

  • Print NxN matrix depicting the placement of army units, with unit numbers delimited by (\t) Tab character
  • Print Total power points collected
  • Print coordinates of power points collected in sequential fashion (one per line)
Constraints: 0 < N <=100

Sample Input and Output

1 2
1 2
4 3
Total Power points : 1
2 5
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
Total Power points : 3

Do share your questions at

TCS CodeVita 2018

Welcome to TCS CodVita Season VII


TCS CodeVita Season Seven is here! TCS CodeVita 2018 (Season 7) is here and I couldn't be more excited. It has been a while since I participated in CodeVita. Last time I participated in 2013. Many of my friends qualified but my team couldn't even clear round 1. Now I am back to studying, legally I can participate. I hope to see better questions and great competition in this contest. I was not blogging regularly since past 1 and half year, but I am back now and hope to help people around. As per TCS, Season 6 witnessed over 200,000 students from 3000+ institutes & 60+ countries take on the challenge. In last season TCS changed the format from Team Participation to individual participation. This will continue in TCS CodeVita 2018 as well.

Purpose of the Contest

The main objective for the contest is to sharpen the contestants' programming skills through some real-life computing practices.  The contest will also
  • Help TCS Spot the bright students
  • Provide students an opportunity to showcase their programming talent and earn peer recognition and honour
  • Provide an opportunity to showcase offerings of TCS to the academic world
  • Provides a platform to students to practice and enhance their programming skills
  • Provide exciting career opportunities for students in TCS

Structure of the Contest

This season TCS is continuing with the Individual participation like the previous edition. There are multiple coding levels before the top finalist can progress into the Grand Finale. To participate in CodeVita, one needs to register on the TCS Campus commune Portal.
There will be 3 main rounds to the contest
  • Pre-Qualifier Round (Round 1) :- Will be conducted as two zonal rounds, a participant will be tagged to one of the two zonal rounds. Details are provided in the round description section.
  • Qualifier Round (Round 2) : - Will be conducted once the pre- qualifier rounds is completed globally. Top performers from all the zonal rounds will compete in the qualifier round. Details are provided in the round description section
  • Grand Finale : The top 30 to 40 students from the qualifier round will take part in the Grand Finale and the top 3 ranked students will win prizes amounting to USD 20,000. Details are provided in the round description section. 
  • MockVita : To help contestants warm up for the contest, practice round(s) will be open to participants who have registered for the contest.This helps you get almost-real-feel of the Contest before the Pre-Qualifier Round. Timeline for the same would be communicated subsequently.

Participant Registration

Welcome to Phase 1 of the contest. Click on the Register button below to register yourself for the contest and start the Team Formation Process.

Important Notes

Starts : 28th March, 2018, 04:30 UTC
Ends : 15th July, 2018, 18:30 UTC
Takes Place : Online

This phase is open now..

TCS CodeVita 2018: Particpant Registration

Eligibility:: Coders from institutes across India who are completing their academic course in 2019, 20, 21 and 22 alone are eligible for this contest. Registrations are invited from students in under graduate/ post graduate programs related to engineering/science background with any specialization.

TCS CodeVita 2018: Registration Guidelines

  • To register for the contest, one has to log on to Campus Commune portal.
  • Students who are already registered on campus commune can directly register for the CodeVita.
  • For new users, you will have to sign-up on campus commune and then proceed to register for CodeVita.
  • It is an individual contest.
  • Each registered participant will be receiving a unique secret code or link at a later stage to take part in the contest.
  • This code/link is of utmost importance to take part in the contest rounds and should not even be shared between team-mates The Secret code/link will also be a part of login credentials for the contest platform.

Any student who is not a bonafide student from institutions or universities in INDIA, registering for INDIA Phase Pre-Qualifier would be disqualified and would not be permitted to participate in the Global Phase Pre-Qualifier as well.

TCS CodeVita 2018: General Guidelines

  • The infrastructure / software(s) required for compiling code solutions shall be borne by the individual participant or the institution he/she represent. TCS will not be liable for any damage to the institute’s infrastructure which may be caused by participants from the institute during the contest.
  • Language compilers are open source applications that can be downloaded from the internet. Participants will need to submit the compiled solution to a problem only. For example, codes written in Java should be submitted in .java format
  • CodeVita platform supports coding in multiple programming languages. Language and supported compiler / interpreter versions will be updated shortly. Broadly the following programming languages will be supported in the contest - C,C++,C#, Java, JavaScript, Pearl, PHP Python, Ruby. Addition of other programming languages will be updated.
  • Coding Guidelines will be provided as separate document. It will include information on scoring and ranking of teams in different rounds, list of URLs from which compilers and IDEs can be downloaded and other coding related instructions

TCS CodeVita 2018: Pre Qualifier Round


Important Notes

Starts: 27th July, 2018, 04:30 UTC
Ends: 11th August, 2018, 04:30 UTC
Bounty: 1000 Points
Takes Place : Online
This phase is not open yet.

The Pre- Qualifier round will be 24 hours contest window and each participant is provided with 6 hours of time to solve the questions. Pre-Qualifier round is done in INDIA as well as Rest of the world separately. This season there will be two zonal rounds in INDIA for Pre-Qualifier.

Details of the zone and the schedule for each zone is as follows

Students can check the branch they are part of from their profile page on Campus Commune and take part in the applicable zonal round.

TCS CodeVita 2018 : Qualifier Round


Important Notes

Starts: 4th December, 2018, 04:30 UTC
Ends: 5th December, 2018, 04:30 UTC
Bounty: 2500 Points
Takes Place: Online
This phase is not open yet.

This season Qualifier Round (Round 2) would happen after the completion of all the Pre-Qualifier rounds across the world.
Top performers from the zonal rounds globally will move into this round.
Each participant will be provided with 6 hours of time to solve & complete this round
The date given here is tentative and the qualifier round is scheduled to be conducted in the first week of December

TCS CodeVita 2018: Grand Finale


Important Notes

Start : 25th February, 2019, 05:30 UTC
Ends: 25th February, 2019, 14:30 UTC
Bounty: 5000 Points
Takes Place: At the Venue
This phase is not open yet.

Will be held in one of the TCSL offices in India.
Top 3 contestant will be declared as winners of the contest.
Winners (Top 3 contestants) will receive a total cash prize of USD 20,000.
TCS will be extending internships and offers to top coders from the contest
The grand finale is tentatively scheduled to be conducted in the last week of February, 2019. (The date indicated is subject to change)

What you can do here

  • Discussion with peers!
  • Find important tips and tricks!
  • Quick quotes for your query!

TCS Interview Experience 2017

Shared by : Sumit
College : BIT Sindri
Year : 2017

Share your experience here:

Hello friends,
I am Sumit Kr Thakur, B. Tech final year student from BIT SINDRI Dhanbad. 

I would like to share the placement experience process that I went through for TCS.

TCS visited our campus on 31st October and 1st November for the intake of 2018 passing out batch of B. Tech and M.Tech.

The whole placement process was divided into the following rounds :-

1. Written test consisting of 4 rounds.
  a) Email writing - 10 min (Take the test here: )
  b) Quantitative aptitude - 40 min(Take the test here: )
  c) MCQ based on C programming language:- 20min
  d) simple coding in C - 20 min

2) Interview

The students who had secured more than 75% in 10th and 12th and >=8.1 CGPA till 6th Semester did not had to give the quantitative aptitude section.

Since I had the CGPA greater than 8.1 and >75% in my academics throughout hence I started with email writing. I had to write a mail to my colleague congratulating him on his research paper getting published. It was mandatory to use and link the keywords provided by the company.
The entire written test is conducted on Touchstone platform created by the TCS itself.
Then I was taken through the MCQ round in C. 10 Questions 20 minutes.

Questions were on basic C concepts such as files, I/O Union array structure etc.  and few questions were output based.

The last was simple coding round. However there were some instructions as not to use the scanf, getc, getch etc  and the input had to be in the form of command line arguments.
The questions that were asked are :-
1. To find the area of a triangle given its diameter
2. To find all the prime numbers upto n and print its square root correct to two places of Decimal and if not prime then print "0.00"

3. Print sum of all odd numbers within a given range.

Finally, I had interview round. They were impressed with my resume and asked basic questions like what I did in internship and coding contests apart from other computer science questions.

Do tell us you experience here:

HackQuest: TCS Ethical Hacking Contest

Here goes a bright opportunity for UG/PG/BCA students passing out in 2017. TCS has launch a new contest HackQuest with prizes like Kindle as well as job offers with TCS' Enterprise Security & Risk Management (ESRM) Unit.

Eligibility Criteria: Open for Technical UG, PG & BCA students of 2017 batch with specialization in Computer Science, IT and Circuit Branches (Electronics & Electrical Engineering, Electronics & Communication, Electronics & Telecommunication, Electrical, Electronics, Electronics & Instrumentation and Instrumentation)

Why should you participate?

Compete with the brightest ethical hackers across India. Embark on a path to become a future cyber security professional and for making a mark in the Risk Management space. Use tools like portswigger. Skill-up and get a head-start for an exciting career, in an ever-connected digital world that demands agility like never before.

What do you win?

Job Offers with TCS' Enterprise Security & Risk Management (ESRM) Unit for top hackers along with other prizes like kindles.

Register yourself now!

If you are a registered member of Campus Commune, Login ( and subscribe to ESRM Channel.
If you are NOT registered on campus commune, Register first on and then launch Campus Commune.


Does problem solving excite you? Is programming your calling? Do you want to join a vibrant community of passionate women technologists? Then here’s what you can do.

ThoughtWorks is a community of passionate individuals whose purpose is to revolutionize software design, creation and delivery, while advocating for positive social change. We are committed to making work amazing for women like you, by being supportive and the right kind of challenging; where assignments, recognition and promotions are ungendered.
Entry Criteria:
  • Experience Range: 0 to 2 years
  • Working knowledge of one or more of the following programming languages:
    • C++, Java, C#, Ruby, Python or Scala
  • Register with your complete details through the below form. 
  • Shortlisted candidates will receive an invite for an in-person interview at their nearest ThoughtWorks location.
Last Date for Registration: 31st January, 2017 (Tuesday)

Comment below to know more info?

Smart India Hackathon 2017

Government of India has announced Smart India Hackathon 2017, world's biggest Hackathon event. However only students registered in a college/institute can participate.

There are total 574 problem statement from different government departments. Submission can be made on any of the given problem statement. Find below the terms & conditions of the Hackathon.

Terms & Conditions – Smart India Hackathon 2017
How to register for Smart India Hackathon 2017?
  • Visit
  • For Registration on MyGov, Click on Register.(
  • Fill the required detail in the account creation form. Click on “Create new account” button after filling all the details:
  • Full Name – Enter the full name.
  • Email – Enter email id by which user want to create the account.
  • Country – Select country from the drop down.
  • Mobile Number – Enter the mobile number without country code. Mobile number is not a required field and system sends different OTP to email and mobile while registration.
  • Complete Registration using OTP (One Time Password) sent on email id– This OTP would be valid only for five minutes. If user has not got OTP, then option of resending OTP is auto generated after 60 seconds. Enter the OTP in the present textbox…to complete verification process.
  • Bingo! You are now ready to submit THREE team entries from your institute/college.
  • Visit:
  • Select Problem statement and Submit your concept.
How should we form a team?
  • A maximum of 3 teams per college/ institute can participate.
  • All team members should be from same college; no inter-college teams are allowed. However, members from different branches of the same college/ institute can form a team.
  • Each team would comprise of 6 members with at least 1 female member. An all-female team is perfect too!
  • All members MUST be well versed with programming skills.
  • Colleges must issue a letter on their letterhead stating the names of the team and team members.
  • The team leader’s name should be clearly specified in the letter.
  • Clearly communicate the email-ids and mobile numbers of all team members as well.
  • The letter should bear the seal of the college/ institute along with signature of the principal.
  • A scanned copy of this letter in PDF form is to be mandatorily submitted during online application process.
  • After teams are shortlisted, each team will be assigned 2 mentors from the industry to guide them during the hackathon; they will augment the team.
How do we submit our idea? Please note: Idea submission must be made by a designated staff member of the college/institute only.
  • Submission dates should be strictly followed. No exceptions will be made.
  • Participants should upload their submission on in a PDF file in the prescribed PPT format available on
  • After login, fill in all the required details for submission of the idea.
  • Entries to be sent only in the prescribed format; otherwise they are bound to get rejected.
  • Upload PDF file of the PPT in the prescribed format, stating the idea and letter from the college (as stated above) to complete the application process.
  • Team may upload a revised PDF file of the PPT for their ideas a day prior to the last day of idea submission. Requests for changes in the Ideas post the cut off date shall not be entertained. Teams will not be able to edit any team details once the team information is saved.
What is a selection criteria?
  • Evaluation criteria will include novelty of the idea, complexity, clarity and details in the prescribed format, feasibility, practicability, sustainability, scale of impact, user experience and potential for future work progression.
  • Preferences will be given to entries from North east while selecting between two similar ideas.
When/where will the shortlisted ideas be announced?
  • Notification about selected teams will be sent to their respective nodal center
  • Keep a track of all announcements and updates on
  • Be available for meetings and training during the preparation phase; will be notified in advance
General information regarding the Grand Finale
  • If a team is selected for the final Hackathon, members will need to travel to the assigned center which can be anywhere in India.
  • Selected teams will be allowed to have 2 seniors as mentors. Mentors can be professors/teachers/ experienced professionals from industry. On selection, total team size will be (6+2) excluding the one who promotes your team on the social media.
  • Each college/institute will be responsible for the travel and accommodation of their teams for the finale.
  • Each college/institute will issue a stamped photo ID to each member of the teams selected. The prescribed format will be available on
  • College photo ID is mandatory for participating in the finale.
What are the prizes to be won?
  • Prizes for the top winners under different categories are
  • 1st prize – Rs.1,00,000/-
  • 1st runner up – Rs.75,000/-
  • 2nd runner up – Rs.50,000/-
Miscellaneous Information
  • Intellectual property (IP) of the idea would belong to the college/institute and the team members jointly. However, team members will make their product available for free for the government institution for which they are working.
  • Selected ideas need to be further developed so that they can be productized before the government institution(s) will be able to utilize it; more efforts beyond the finale are required from the selected teams thereafter.
For any queries please contact: