CodeVita Season III (2014 – 2015 Season)
CodeVita Questions Broadly speaking Three types of problems – {Simple, Medium, Complex} Questions of season III have following flavours String Manipulation Formula-based Algorithmic (Greedy, Genetic, Dynamic programming) Real-life Data Structures (Trees, Graphs, Bit Set etc.) Single-correct answer (most of the times), Verified Solvability (Space-time constraints)
Example of Simple Problem Bob’s List Find out students studying Physics and Maths Physics or Maths Physics but not Maths Students studying Physics Students studying Maths
Example of Simple Problem Stone Removal Ladies First - Alice always plays first Each player can remove only 1, 2 or 3 stones Assume optimal play by both sides For Generic N, where N is the # of stones, predict if Alice can win 2 2, 2 3, 1, 2 3, 1 3 Bob has to remove last stone. Hence Alice wins !!
Example of Medium Problem Break the Friendship During exams, friends cheat Two rooms are available for the exam Given a list of friends Create two groups of students such that no two friends are in the same group
Example of Medium Problem Online Communities - Connectivity People connect with each other in a social network. When two persons belonging to different communities connect, the net effect is merger of both communities which they belonged to In a constantly changing social graph, find out whether two persons are in a same group or not
Example of Complex problem Isotope Algorium=33 (56 * 61) mod 199 Codium=56 Programium=61 Energy = 3416 KJ (56 * 61) Developium=2 Energy = 66 KJ (33 * 2) Total energy produced = 3416 KJ + 66 KJ = 3492 KJ Testium=122 (61 * 2) mod 199 Programium=61 Developium=2 Energy = 122 KJ (61 * 2) Codium=56 Energy = 6832 KJ (56 * 122) Total energy produced = 122 KJ + 6832 KJ = 6954 KJ When 2 atoms fuse energy is released and a new atom is formed Only adjacent atoms can be fused Codium=56 Programium=61 Developium=2 Second solution is better because it maximizes energy produced
Example of Complex problem White To Move Number of moves possible for White = 20 Number of moves possible for White = 18 Always, White to Move Ignore Castling and En Passant rules of Chess Compute number of possible moves for white in any arbitrary board position