Skip to main content

Are you String Lover?

Most asked on strings in coding interviews.

A string is traditionally a sequence of characters, either as a literal constant or as some kind of variable.


1)Check the given string is a palindrome or not

Ex:- input: pop
       output:true

2)Check the given two strings is an Anagram or not

An anagram of a string is another string that contains the same characters, only the order of characters can be different. For example, “abcd” and “dabc” are an anagram of each other.

3)Check the given string is balanced or not

Input String will contain "a-z", "( )","[ ]" and "{ }" .The brackets must close in the correct order.
Ex: input: abc(){[]}      output: valid 
       input: (zyx)[{)}]    output: invalid

4)Print the most repeated character in a given string

Ex: input: Apple       output: p
       input: Google     output: o

5)Print the occurrence of each character in a given string

Ex:input: Apple        output: A-1,p-2,l-1,e-1

6)Remove the substring

Given two strings s1 and s2.where s1 is the main string and s2 is a substring print string after removing s2 in s1
Ex: input: s1=String is loving
                 s2=ing
       output: Str is lov

7)Print the first non-repeating character in a given string

Ex: input: java                   output: j 
       input: options             output: p

8)Reverse the given sentence

Ex: input-1: I love coding
       output-1: coding love I

       input-2: support.mission.hack
       output-2: hack.mission.support

9)Compress the given string

Ex: input: aabbbccdd
       output: a2b3c2d2

Some more questions will be added soon. 

Cheers keep coding

Comments

Popular Posts

NCET CodingClub Programming Questions

Programming Questions asked for NCET CodingClub Monsters Hunt CodingClub Facebook Page:  Click Here 1)Find the nth number in the series Series: 1 5 13 25 41 61 85 113 Simple Input and Output Input: 5 Output: 41 2)Monsters hate zeros help them in finding the correct digits.Prove that "a+b+c=d" where a,b,c, and d are Integers. Condition: Remove all the zeros if present in a,b,c, and d Simple Input and Output: Test Case 1: Input : 101 102 103 306 Output: Valid Test Case 2: Input : 1010 1002 0103 2115 Output: Invalid 3)Print the Pattern For solutions  Click Here Cheers keep coding. 

Programming Questions

Lets, Get Started with programming Starting with basic programming questions Check given number is prime or not (Ex: input=3, output = Prime Number) Print prime number between a range Check given number or string is palindrome or not  Find the sum of all elements in a given array Find the sum of all elements which are in odd positions(index) in a given array Print alphabets from A-Z or a-z using while or for loop

Numbers

Programming Questions on Numbers 1) Given a number find the sum of all digits in a number     Input: n = 1234 output: 10     Explanation: 1+2+3+4 = 10 2) Given a number check given number is palindrome or not      Input: n = 12321     output: Palindrome      Input: n = 123         output: not Palindrome 3) Given a number increase each digit by 1 if the digit is 9 make it 0     Input: n = 1798      output: 2809     Explanation:  1 is increased by 1 becomes 2 and the same for the rest of the digits. 4) Given a number find the prime sum     Input: n = 2345       output: 10     Explanation: In the given digits 2,3 and 5 are prime digits so find the sum all prime numbers. 5) Find the biggest of 3 numbers     Input: a=10, b=20, c=15 output: Biggest is 20 6) Find the highest frequency of digit in a given number     Input: n = 1998    output: 9     Explanation: In 1998 , most repeated digit is 9 7) Find a repeated digit in a given number     Input: 2020       output