Most Frequent Word in Array
Given an array arr containing N words consisting of lowercase characters. Your task is to find the most frequent word in the array. If multiple words have same frequency, then print the word whose fi ...
Elevate Your Coding Skills
HomeJava Code
Given an array arr containing N words consisting of lowercase characters. Your task is to find the most frequent word in the array. If multiple words have same frequency, then print the word whose fi ...
Given two number a and b, find their HCF. What Is HCF? HCF or Highest Common Factor is the greatest common divisor between two numbers. Input Format The first line of input contains the integers a and b. ...
Given a square matrix of size N, calculate the absolute difference between the sums of its diagonals. Input Format The first line contains a single integer N, the number of rows and columns in the square matrix . Each of the next N lines de ...
Given an array of integers, you need to find its maximum value element. Input The input contains N spaced integers. There is no size of the array given beforehand. You will have to use some other way of reading input values. Constraints ...
Marc loves cupcakes, but he also likes to stay fit. Each cupcake has a calorie count, and Marc can walk a distance to burn those calories. On eating the jth cupcake with c calories, he must walk at least (2ʲ)*c miles to maintain his weight. Fo ...
Robin just received a stopwatch from her grandfather. Robin’s stopwatch has a single button. Pressing the button alternates between stopping and starting the stopwatch’s timer. When the timer is on, the displayed time increases by 1 every second. ...
Given a string S consisting only of lowercase characters. We need to check whether it is possible to make this string a palindrome after removing exactly one character from this. If it is possible then print 1 else return  ...
Given an array of integers arr, find the sum of the minimums of all contiguous subarrays of the array. Since the answer may be large, print the answer modulo 10^9 + 7. Input Format The first line contains a single integer n(size of the array) ...
Given an integer array arr of size n. For each element in the array, check whether the right adjacent element (on the next immediate position) of the array is smaller. If next element is smaller, update the current index to that element. If not, the ...
Given an array arr of size n of non-zero positive integers, the task is to find the next greater element for each element of the array in order of their appearance in the array. Next greater element of an element in the array is the nea ...