Issue 2 test case not passed

    String ans="";
	int i=-1;
	int j=-1;
	HashMap<Character,Integer> map=new HashMap<>();
	int needCount=s2.length();
	for(int k=0;k<s2.length();k++){
		map.put(s2.charAt(k),map.getOrDefault(s2.charAt(k),0)+1);
	}
	HashMap<Character,Integer> map2=new HashMap<>();
	int useful=0;
	
	while(true){
		boolean f1=false;
		boolean f2=false;
		while(i<s1.length()-1&& useful<needCount){
            i++;
			char ch=s1.charAt(i);
			map2.put(ch,map2.getOrDefault(ch,0)+1);
			if(map2.getOrDefault(ch,0)<=map.getOrDefault(ch,0)){
				useful++;
			}
			f1=true;
			
		}
        
		while(j<i&&useful==needCount){
        
			String temp=s1.substring(j+1,i+1);
			if(ans.length()==0||temp.length()<ans.length()){
				ans=temp;

			}
            j++;
            char ch=s1.charAt(j);
            
           if(map2.get(ch)==1){
               map2.remove(ch);
           }else{
               map2.put(ch,map2.get(ch)-1);
           }
            if(map2.getOrDefault(ch,0)<map.getOrDefault(ch,0)){
                useful--;
            }
			f2=true;
		}
		if(f1==false&&f2==false){
			break;
		}


	}



	return ans;

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.