SQL Murder Mystery
The SQL Murder Mystery is a fun little exercise to practice some basic (and not so basic) SQL statements. As a SQL master, your mission is to discover the murder that took place...
The SQL Murder Mystery is a fun little exercise to practice some basic (and not so basic) SQL statements. As a SQL master, your mission is to discover the murder that took place...
One of the first puzzles in the book we are required to solve, instead of just reading through the logic, is this: A man was looking at a portrait. Someone asked him, “Whose...
C++ : Explanation: First, assign a large number to maxInt and assign it to minDist. In this case, we use the largest possible int, 2,147,483,647. Using a double nested for loop, loop through...
Java : Explanation: First, sort the array so that counting the number of repeated elements in the array is easier. After sorting, assign the first element of the array arr[0] to prevInt. countInt...
C++ : Explanation: First, check if y2 is greater than y1. If yes, it means the book was returned at a non expired date, and fineAmount is set to 0. Else, if the...
Java : Explanation: Warning: Lots of converting from ArrayLists to Arrays and vice versa ahead! First, convert the ArrayList sticks to store the number of sticks left after each cut-and-throw round. Add the...
Java : Explanation: This is a fun question. At first sight, the idea to answer this would be to take the range of numbers from a to b, and run a for loop...
Java : Explanation: This question is so much easier done in Java, since Java has the BigInteger class that supports huge numbers. Another language that supports these big numbers is Ruby. The for...
C++ : Explanation: This question involved rotating the elements in a vector. The good thing is, C++ has a nice little in-built function to do that. First, we take mod k by a.size(),...
C++ : Explanation: This question basically deals with getting individual digits from a number with mod (%) and integer division. In the while loop, we will loop till nHolder (temporary holder for n)...