-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjava.json
2 lines (2 loc) · 3.35 KB
/
java.json
1
2
{"_id":{"$oid":"5b851fb86f591f12c8021a17"},"q_name":"Candies","q_desc":"n children have got m pieces of candy. They want to eat as much candy as they can, but each child must eat exactly the same amount of candy as any other child. Determine how many pieces of candy will be eaten by all the children together. Individual pieces of candy cannot be split. Example For n = 3 and m = 10, the output should be candies(n, m) = 9. Each child will eat 3 pieces. So the answer is 9.","q_const":" Guaranteed constraints: 2 ≤ m ≤ 100 , 1 ≤ n ≤ 10.","q_inp":"3 10","q_oup":"9","test_id":"t_Candies"}
{"_id":{"$oid":"5b8520ed6f591f12c8021a18"},"q_name":"Grouping Dishes","q_desc":"You have a list of dishes. Each dish is associated with a list of ingredients used to prepare it. You want to group the dishes by ingredients, so that for each ingredient you'll be able to find all the dishes that contain it (if there are at least 2 such dishes). Return an array where each element is a list with the first element equal to the name of the ingredient and all of the other elements equal to the names of dishes that contain this ingredient. The dishes inside each list should be sorted lexicographically. The result array should be sorted lexicographically by the names of the ingredients in its elements. Example For dishes = [[\"Salad\", \"Tomato\", \"Cucumber\", \"Salad\", \"Sauce\"], [\"Pizza\", \"Tomato\", \"Sausage\", \"Sauce\", \"Dough\"], [\"Quesadilla\", \"Chicken\", \"Cheese\", \"Sauce\"], [\"Sandwich\", \"Salad\", \"Bread\", \"Tomato\", \"Cheese\"]] the output should be groupingDishes(dishes) = [[\"Cheese\", \"Quesadilla\", \"Sandwich\"], [\"Salad\", \"Salad\", \"Sandwich\"], [\"Sauce\", \"Pizza\", \"Quesadilla\", \"Salad\"], [\"Tomato\", \"Pizza\", \"Salad\", \"Sandwich\"]] For dishes = [[\"Pasta\", \"Tomato Sauce\", \"Onions\", \"Garlic\"], [\"Chicken Curry\", \"Chicken\", \"Curry Sauce\"], [\"Fried Rice\", \"Rice\", \"Onions\", \"Nuts\"], [\"Salad\", \"Spinach\", \"Nuts\"], [\"Sandwich\", \"Cheese\", \"Bread\"], [\"Quesadilla\", \"Chicken\", \"Cheese\"]] the output should be groupingDishes(dishes) = [[\"Cheese\", \"Quesadilla\", \"Sandwich\"], [\"Chicken\", \"Chicken Curry\", \"Quesadilla\"], [\"Nuts\", \"Fried Rice\", \"Salad\"], [\"Onions\", \"Fried Rice\", \"Pasta\"]]","q_const":"[execution time limit] 3 seconds (java) Guaranteed constraints: 1 ≤ dishes.length ≤ 500, 2 ≤ dishes[i].length ≤ 10, 1 ≤ dishes[i][j].length ≤ 50.","q_inp":"[input] array.array.string dishes An array of dishes. dishes[i] for each valid i contains information about the ith dish: the first element of dishes[i] is the name of the dish and the following elements are the ingredients of that dish. Both the dish name and the ingredient names consist of English letters and spaces. It is guaranteed that all dish names are different. It is also guaranteed that ingredient names for one dish are also pairwise different.","q_oup":"[output] array.array.string The array containing the grouped dishes."}