You are viewing a single comment's thread. Return to all comments →
Java
public static List<Integer> icecreamParlor(int m, List<Integer> arr) { List<Integer> indices = new ArrayList<>(); for (int i = 0; i < arr.size(); i++) { for (int j = i + 1; j < arr.size(); j++) { if (arr.get(i) + arr.get(j) == m) { indices.add(i + 1); indices.add(j + 1); break; } } } return indices; }
Seems like cookies are disabled on this browser, please enable them to open this website
Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
Java