is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.
Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.
Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.
package LetsDevelopSmthing;
- rtripathi185 September 23, 2015import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class PositionCls {
public static int GlobalCount=0;
public static void main(String []args)
{
int x[][]={{1 ,1, 1, 0, 1, 0, 1, 1, 0, 0 },
{0, 0, 1, 1, 1, 0, 1, 0, 0, 0 },
{0 ,0, 0, 0, 0, 0, 0, 0, 0, 0 },
{0 ,0, 0, 0, 1, 0, 1, 0, 0, 0 },
{0 ,0, 0, 1, 1, 1, 1, 0, 0, 0 },
{0 ,0 ,0 ,0 ,0 ,0 ,1 ,0, 0, 1 },
{0 ,0, 0, 0, 0, 0, 0, 0, 0, 0 },
{1 ,0, 0, 0, 0, 1, 0, 0, 0, 0 },
{1 ,0, 0, 0, 0, 1, 1, 0, 0, 0 },
{1 ,0, 0, 0, 0, 0, 0, 1, 0, 1 }
};
int countNewIsland=0;boolean check;
HashMap hs=new HashMap();
for(int i=0;i<x.length;i++)
{
for(int j=0;j<x.length;j++)
{
if(x[i][j]==1){
hs.put(i+"-"+j, new Integer(0));
}
}
}
Iterator itr= hs.entrySet().iterator();
while(itr.hasNext())
{
Map.Entry me= (Entry) itr.next();
int check1=checkNeighbour((String) me.getKey(),hs);
System.out.println(" "+check1+" "+me.getKey());
if(check1>0)
GlobalCount++;
}
System.out.println(" No of island : "+GlobalCount);
}
private static int checkNeighbour(String str,HashMap h){
int count=0;
if(!h.containsKey((str))) return 0;
if(h.get(str).equals(new Integer(1))) {return 0;}
else{
h.put(str, new Integer(1));count++;
}
String[] st=str.split("-");
int x=Integer.parseInt(st[0]);
int y=Integer.parseInt(st[1]);
String up=(x-1)+"-"+y;
String down=(x+1)+"-"+y;
String left=x+"-"+(y-1);
String right=x+"-"+(y+1);
checkNeighbour(up,h);
checkNeighbour(down,h);
checkNeighbour(left,h);
checkNeighbour(right,h);
return count;
}
}