Paytm Visited Thapar Institute , Patiala on 18-08-2020.
Online Round (3 Coding Questions)
1. Given an array of positive integers and a no K. Find the largest number which has the digit K in majority. Example [ 4,23,324,334,44,434,443 ] and K=4 Now 4 , 44 , 234 , 443 have 4 in majority so we return 443 which is the maximum.
2. In an array of even length rearrange the elements such that even elements occur at even indices (0,2,4,...) and odd elements occur at odd indices (1,3,5,....). It is guaranteed that no of odd elements is equal to no of even elements. You must maintain the relative order of both even and odd elements among themselves. Also you must not use any extra space.
3. Given reference to any node of a tree return the distance to its nearest leaf .