Geek and Number String Geeks For Geeks
Problem Link: https://practice.geeksforgeeks.org/problems/904237fa926d79126d42c437802b04287ea9d1c8/1 (It is also the problem of the day for 23-09-2022) Solution: class Solution { public int minLength(String s1, int n) { Stack<Character>stack=new Stack<Character>(); for(int i=0;i<s1.length();i++){ if(stack.isEmpty()){ stack.push((s1.charAt(i))); } else{ String s=""; s+=(stack.peek()); s+=(s1.charAt(i)); if(s.equals("12") || s.equals("21") || s.equals("34") || s.equals("43")|| s.equals("56") || s.equals("65")|| s.equals("78") || s.equals("87") || s.equals("90") || s.equals("09")){ ...