Coding Questions
Coding Questions
String str="pwwkew";
char[] chrStr=str.toCharArray();
for(Character c : chrStr){
if(map.containsKey(c)){
map.put(c,map.get(c)+1);
}
else{
map.put(c,1);
}
}
System.out.println(map);
}
}
import java.util.LinkedHashMap;
int longestSubstringLength = 0;
if (!hash.containsKey (c)) {
}else {
i = hash.get (c);
hash.clear ();}
}
}
}
}
Date date;
this.date=new date(date.getTime());
class printOddEvenNumbers{
int counter=1;
Int MAX= 20;
boolean odd;
Synchronized(this){
while(counter<MAX){
while(!odd){
wait();
}
counter++;
odd=false;
notify();
while (counter<MAX){
while(odd){
wait();
}
}
import java.util.HashMap;
import java.util.Stack;
static {
bMap = new HashMap<>();
bMap.put('(', ')');
bMap.put('[', ']');
bMap.put('{', '}');
}
String s="{{[[(())]]}}";
String result = isBalanced(s);
System.out.println(result);
} }
Map<StringLong>
collect=list.stream().collect(Collectors.groupingBy(function.Identity,Collectors.co
unting());
list.stream().filter(e1->e1.getSalary()>5000).collect(Collectors.asList());
list.stream().flatMap(e->Stream.of(e)).collect(Collectors.asList());
SELECT MAX (column_name) FROM table_name WHERE column_name NOT IN (SELECT Max
(column_name) FROM table_name)
select * from( select ename, sal, dense_rank() over(order by sal desc) r from
Employee) where r=3;
//producer Consumer
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
BlockingQueue<Integer> obj;
BlockingQueue<Integer> obj;