2021年3月25日星期四

I can't get this Hackerrank challenge: trying to work with an undirected graph

I am trying to complete this HackerRank challenge: hackerrank.com/ps4-programming-assignment-minimize-bias

But, I am not able to find a solution. Here is how I get the numbers from the input (using java):

Scanner in = new Scanner(System.in);  int l = in.nextInt();  int k = in.nextInt();  in.nextLine();  ArrayList<ArrayList<Integer>> li = new ArrayList<ArrayList<Integer>>();  while(in.hasNextLine()){      String s = in.nextLine();      StringTokenizer defaultTokenizer = new StringTokenizer(s);      ArrayList<Integer> lo = new ArrayList<Integer>();      while (defaultTokenizer.hasMoreTokens())      {          lo.add(defaultTokenizer.nextToken());      }      li.add(new ArrayList<>( lo ));  }  
https://stackoverflow.com/questions/66808232/i-cant-get-this-hackerrank-challenge-trying-to-work-with-an-undirected-graph March 26, 2021 at 06:06AM

没有评论:

发表评论