Coding Questions Asked in HackerRank
21 / 29
There are two strings, s, and t.
Perform two operationss with the string s:
1. Working from left-to-right delete each occurrence of t in s until there are no more occurrences of t. Count each deletion.
2. working from right-to-left delete each occurrence of t in s until there are no more occurrences of t. Count each deletion.
When that is done, return the greater of the two counts; deletion left-to-right or deletions right-to-left.
Example
s = 'bcbbc'
t = 'b'
From left to right:
Remove th first occurrence t = 'b' from"
Input : NA
Output : NA
Tags:SAP Labs
22 / 29
Input : arr[] = {10, 50, 12, 100}
Output : (10, 12)
The closest elements are 10 and 12
Input : arr[] = {5, 4, 3, 2}
Output :
Tags:SAP Labs
23 / 29
Input : NA
Output : NA
Tags:Amazon
24 / 29
The function has the following parameters:
cars: integer array of length denoting the parking slots where cars are parked
k: integer denoting the number of cars that have to be covered by the roof
Example:
Input:
cars: [2, 10, 8, 17]
k: 3
output: 9
Explanation: you can build a roof of length 9 covering all parking slots from the 2nd one to the 10th one, so covering 3 cars at slots 2, 10, 8, there are no shorter roof that can cover 3 cars, so the answer is 9
Note:
1 <= n <= 10^5
1 <= k <= n
1 <= cars[i] <= 10^14
All slots token by cars are unique
Input : cars: [2, 10, 8, 17]
k: 3
Output :
Tags:Amazon
25 / 29
If multiple characters occur with the same highest frequency then return "0".
Input : Input1: abcdd
Output :
Tags:TCS NQT Nagarro Wipro NLTH
26 / 29
Given 'n' (1 <= n <= 100000), find the nth prime number.
Input : An integer n
Output :
Tags:TCS NQT Nagarro Wipro NLTH
27 / 29
Given a number n, find the total number of Derangements of a set of n elements.
Input : 1st Input: n = 2
For two elements say {0, 1}, there is only one
possible derangement {1, 0}
2nd Input: n = 3
For three elements say {0, 1, 2}, there are two
possible derangements {2, 0, 1} and {1, 2, 0}
Output :
Tags:TCS NQT Nagarro Wipro NLTH
28 / 29
Write a function to decrypt the string and find the nth character of the decrypted string. If no character exists at that positionthen then return "-1".
For eg:- If the input string is "a2b3" the decrypted string is "aabbb".
Note: The frequency of encrypted string cannot be greater than a single digit i.e.<10.
Explanation:
The decrypted string is "abccc", hence the 5th character in the decrypted string is "c".
Input : Input Specification:
Input1: A string.
Input2:5
Output :
Tags:Nagarro Wipro NLTH TCS Ninja
29 / 29
Input : Input1: N, the number of Objects.
Input1: 3
Output :
Tags:Nagarro Wipro NLTH Wipro NLTH
Q4I highly advised to practice all the page 3 basics and standard program asked at freshers or experienced level job interview in HackerRank. Practice our hand-picked coding interview questions asked in HackerRank Page 3. You can programed the given question in any language, you can post your answer and same time you can review the other answer. It is always recommanded to write your own program first and then refer others answers. At this page we have covers all the HackerRank coding questions in 2020 and previously asked in their Interview round or coding rounds.
Top Kudos Contributor
Trending Programming Qs.
- Given a string, say sentence=" this is crazy and fun" and a list, say ...
- Write a program to print next to the last word of a sentence.
- Write a program to generate a simple pattern. 1 12 123 1234 123 ...
- There are many cars parked in the parking lot. The parking is a straig...
- Write fibonacci series program. INPUT: 10 term OUTPUT: 0 1 1 2 3 5...
- Write a program to print next to the last word of a sentence.
Last Month Contributor
- Write a program to print next to the last word of a sentence.
- Write a program to convert uppercase to lower case and vice versa of a...
- Given a string, say sentence=" this is crazy and fun" and a list, say ...
- Write a program to remove the vowels from the input string.
- Write fibonacci series program. INPUT: 10 term OUTPUT: 0 1 1 2 3 5...