Skip to main content

Posts

Recent Posts

largest odd number in string

 class Solution {     String maxOdd(String s) {         // code here         int n=s.length();         int ind=-1;         //finding the largest odd digit         for(int i=n-1; i>=0; i--){             if((s.charAt(i))%2==1){                 ind=i;                 break;             }         }         if(ind==-1) return "";         //skipping leading zeroes         int i=0;         while(i<=ind && s.charAt(i)=='0') i++;                  return s.substring(i,ind+1);     } }

Latest Posts

BFS Traversal in Tree !

count maximum consecutives ones 1

find the missing number in array

Find the union of the two sorted Arrays !! using two pointer approach