1 codevita season iii (2014 – 2015 season). 2 codevita questions broadly speaking three types of...

8
CodeVita Season III (2014 – 2015 Season)

Upload: marylou-pearson

Post on 02-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 CodeVita Season III (2014 – 2015 Season). 2 CodeVita Questions  Broadly speaking Three types of problems – {Simple, Medium, Complex}  Questions of

1

CodeVita Season III(2014 – 2015 Season)

Page 2: 1 CodeVita Season III (2014 – 2015 Season). 2 CodeVita Questions  Broadly speaking Three types of problems – {Simple, Medium, Complex}  Questions of

2

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)

Page 3: 1 CodeVita Season III (2014 – 2015 Season). 2 CodeVita Questions  Broadly speaking Three types of problems – {Simple, Medium, Complex}  Questions of

3

Example of Simple Problem

Bob’s List

Students

studying

Physics

Students

studying Maths

Find out students studying

• Physics and Maths• Physics or Maths• Physics but not Maths

Page 4: 1 CodeVita Season III (2014 – 2015 Season). 2 CodeVita Questions  Broadly speaking Three types of problems – {Simple, Medium, Complex}  Questions of

4

Example of Simple Problem

Stone Removal

32 3, 12, 2 3, 1, 2

Bob has to remove last stone. Hence Alice wins !!

• 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

Page 5: 1 CodeVita Season III (2014 – 2015 Season). 2 CodeVita Questions  Broadly speaking Three types of problems – {Simple, Medium, Complex}  Questions of

5

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

Page 6: 1 CodeVita Season III (2014 – 2015 Season). 2 CodeVita Questions  Broadly speaking Three types of problems – {Simple, Medium, Complex}  Questions of

6

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

Page 7: 1 CodeVita Season III (2014 – 2015 Season). 2 CodeVita Questions  Broadly speaking Three types of problems – {Simple, Medium, Complex}  Questions of

7

Example of Complex problem

Isotope

When 2 atoms fuse energy is released and a new atom is formed

Only adjacent atoms can be fused

Codium=56

Programium=61

Developium=2Algorium=33(56 * 61) mod 199

Codium=56

Programium=61

Energy = 3416 KJ(56 * 61)

Algorium=33

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

Testium=122 Energy = 6832 KJ(56 * 122)

Total energy produced = 122 KJ + 6832 KJ = 6954 KJ

Second solution is better because it maximizes energy produced

Page 8: 1 CodeVita Season III (2014 – 2015 Season). 2 CodeVita Questions  Broadly speaking Three types of problems – {Simple, Medium, Complex}  Questions of

8

Example of Complex problem

White To Move

Number of moves possible for White = 20Number 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