Reinfected Solution | CodeChef Puzzle in C++

Problem We are very near to our goal now. The enemy is being weakened continuously. But alas, sensing his fall, the hacker has spread a worm into our network. It is consuming all our files at a tremendous rate and must be stopped at all costs. The only way to stop […]

Hardware Store | CodeChef Puzzle in C++

Problem Aman has a hardware store in Una. One day when he went down to the store room to fetch a box of nails. He found that the price tag had faded out. The first and the last digits of the price were not readable. Although, the number of nails in […]

Riled Solution | CodeChef Puzzle in C++

Problem Someone is trying to break into Thapar University’s Database and steal sensitive research information. It is now up to us to stop this attack. Fortunately our defense mechanisms have traced the attacks to their source. The fastest way to stop the attacks is to disable the source. So all we […]

Check if string contains substring in C++

Problem Given two strings, A and B, output true if B is a substring of A and false otherwise. Input The first line contains the number of test cases T. This is followed by T lines each consisting of pairs of binary strings A and B. Output Output true if B […]

Find the next smallest palindrome solution [Easy]

Problem For a given positive integer K of not more than 5 digits, write the value of the smallest palindrome larger than K to output. Numbers are always displayed without leading zeros. Codechef Problem Link Input The first line contains integer T, the number of test cases. Integers K are given […]

Palindrome Solution [Easy]

Problem A simple recursive method to generate a numeric palindrome from any number is to reverse its digits and add it to the original. If the sum is not a palindrome (which means, it is not the same number from left to right and right to left), repeat this procedure. For […]

Problem 1 Solution | CodeChef

Problem Reversed number is a number written in arabic numerals but the order of digits is reversed. The first digit becomes last and vice versa. For example, if the number is 1245, it will become 5421. Note that all the leading zeros are omitted. That means if the number ends with […]