Pair of Socks puzzle: You have 100 black socks and 100 white socks mixed up in a drawer. You must pick socks blindly from the
Burning ropes Puzzle: You have two ropes and a lighter. Each rope takes exactly 60 minutes to burn completely. Given ropes burn inconsistently (for example,
C++ std::map::insert – Simple program example to add key value pair in a map. The map data structure stores key value pair. Here is how
Interview puzzle: If you have 20 people in a party and each shakes everyone else’s hand only once, how many handshakes take place? Use the
Interview Puzzle: There are four persons A, B, C and D who wants to cross a weak bridge in the night. They have one torch
C++ map update – Simple program example to update value in map. To update an existing value in the map, first we will find the
PUZZLE: You have three jugs. They can hold 12 liters, 8 liters, and 5 liters of milk or say water respectively. 12-liter jug is full
C++ map :: find() function – Example to find an element by key into a map. Also, check if key exists into a map in
Answer includes runtime polymorphism example program in C++ OOPs and about virtual and pure virtual function in C++. Example of run time polymorphism in C++
Logic is simple to print numbers from 1 to 100 without using loops in C++ code. Note that recursion and goto statements are also not