Posts

Showing posts from March, 2023

STRING

 PALINDROME public class Solution {     public int isPalindrome ( String A ) {         A = A . toLowerCase ();         StringBuilder b = new StringBuilder ();         for ( int i = 0 ; i < A . length (); i ++){             if ( Character . isDigit ( A . charAt ( i ))|| Character . isLetter ( A . charAt ( i ))){                 b . append ( A . charAt ( i ));             }         }         int n = b . length ()- 1 ;         for ( int i = 0 ; i < b . length ()/ 2 ; i ++){             if ( b . charAt ( i )!= b . charAt ( n - i )) return 0 ;         }         return 1 ;     } } Vowel and Consonant Substrings! public class Solution {     public int s...