Previous Questions asked in Interviews

Infosys:

  1. Take a string as input from the user. Print the index of the first non-repeating character in the string. Print -1 If there isn’t any such character.
  2. Take n number of strings as input from the user. (You can take n as input as well.)

RSL:

  1. Print a number in it’s expanded form. Ex. 2324 : 2000 300 20 4
  2. Program to find non-repeating characters from a string
  3. [Leetcode 66] You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0's. Increment the large integer by one and return the resulting array of digits.
  4. Take an array as input. Print second max difference among the elements of the array.
  5. Take a year as input. Print if it is a leap year or not.
  6. Take a string as input and return the string with the count of each character in the string in sequence they occur.
    Ex. Input : AAABBCCADDD  Expected Output: A3B2C2AD3
  7. For the given amount, you would have to pay a minimum number of coins of 5’s and 2’s.
  8. Take an array of length n as input. x an integer as input. Print the smallest number greater than x which is not present in the given array.\
  9. Take a binary string as input. Sort the string in minimum number of swapping
    Ex. Input: 011001 Expected Output: 000111

HCL:

  1. Take the distance in km as input. Convert it to meters, cm or mm as per users need.
  2. Count the number of distinct characters in input string.

Post a Comment

Previous Post Next Post