- Count for how many problems, at least 2 participants are sure about the solution and print the result.
- Return the integer value of the total area of the rectangular board divided by the area of a single domino to find the number of dominoes fitting in the board.
- Push the levels both players can play in a single dynamic array.
- Compare each level to the above array elements, if matched once, update the counter and continue to compare for the next level.
- If the counter matches the total number of levels, it means that each level has appeared at least once in the players' collective list of playable levels.
- Print the statements accordingly.
- Put all cards in an array, and loop through it till the left and the right sides of the array point to the same element.
- Initialize a counter with 1. Its odd value means Sereja's turn while even value means Dima's turn.
- For each player's turn, find the larger number between the leftmost and the rightmost elements, add it to the player's points, and update the loop variables accordingly.
- Print the points earned by both the players.
- Sort 'a' in ascending order and 'b' in descending order.
- Replace the first k values of 'a' with the first k values of 'b' until a's element is lesser than b's corresponding element.
- Find the sum of all elements of 'a' and print it.
- All even numbers are a sum of two even numbers (or two odd numbers), 2 being the exception. No odd number will be a sum of two even numbers.
- Hence, print "YES" for all even numbers except 2 and "NO" for all other numbers.
- As all scores are already written in descending order, we have to extract k-th participant's score, which is
array[k-1]
. - There will be more participants with an
array[k-1]
score, therefore, we have to search for all participants in the whole array with a score equal to or greater than this and return the count. - Exceptional case would be where k's score is 0, hence all scores are 0. This would satisfy the above condition. So handle it.
- Iterate through the array for each element, searching for a condition when at particular indices, the elements are equal but characters in the string at the corresponding indices are not.
- If the condition is met, a counter is incremented.
- At last, if the counter is more than 0 then print "NO" otherwise print "YES".
- Implement if-else statements.
- See code for better comprehension.
- Identify the minimum number of candies present in a box.
- All boxes should have candies equal to this minimum number. Therefore, keep a record of how many candies should be remaining overall (min*n).
- Now the number of candies required to be eaten by me should be the difference between the expected remaining candies and all candies present initially.