Substring for given two chars

Given a string, determine the length of the smallest substring that contains exactly one occurrence of 'a' and one occurrence of 'b' If there are no such substrings, return 0 Input : ahhhxb Output : 6 Input : ahobpa Output : 3 Input : qqqop Output : 0

Answer



Find Max Continuous Repeating Char

Given a string, return the character that is repeated the most number of times continuously. Note: Do not count the character that occurs most overall, but count only the character that occurs most number of times continuously Note: If two characters occur the same number of times continuously, return the first such in the string. Input : AABBBC Output : B Input : AAABBB Output : A

Answer

Pattern Problem | Right angle Triangle



Output

Sample 1



Enter the limit:
5
*
==========
*
**
==========
*
**
***
==========
*
**
***
****
==========
*
**
***
****
*****

==========

Sample 2

Enter the limit:
10
*
==========
*
**
==========
*
**
***
==========
*
**
***
****
==========
*
**
***
****
*****
==========
*
**
***
****
*****
******
==========
*
**
***
****
*****
******
*******
==========
*
**
***
****
*****
******
*******
********
==========
*
**
***
****
*****
******
*******
********
*********
==========
*
**
***
****
*****
******
*******
********
*********
**********
==========

Program to find FLAMES in java


Output

Enter your name: 
Jothibasu
Enter your partner's name: 
people
The number is : 13

people is your Affection


Enter your name: 
Jothibasu
Enter your partner's name: 
Google
the number is : 11

Google is going to marry You


Odd numbers in odd index of array | Even numbers in even index of array

This logic is written only for equal number of odd and even numbers




Sample Output 

Enter array size:
6
Enter array elements:
1 2 3 4 5 6
After Shifting array elements :
5

Source Code