Skip to content

Commit e85db19

Browse files
authored
Improved task 2070.
1 parent b98c847 commit e85db19

File tree

1 file changed

+16
-10
lines changed
  • src/main/java/g2001_2100/s2070_most_beautiful_item_for_each_query

1 file changed

+16
-10
lines changed

src/main/java/g2001_2100/s2070_most_beautiful_item_for_each_query/readme.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@ Return _an array_ `answer` _of the same length as_ `queries` _where_ `answer[j]`
1414

1515
**Output:** [2,4,5,5,6,6]
1616

17-
**Explanation:** -
17+
**Explanation:**
1818

19-
For queries[0]=1, [1,2] is the only item which has price <= 1. Hence, the answer for this query is 2.
19+
- For queries[0]=1, [1,2] is the only item which has price <= 1. Hence, the answer for this query is 2.
2020

21-
- For queries[1]=2, the items which can be considered are [1,2] and [2,4].
21+
- For queries[1]=2, the items which can be considered are [1,2] and [2,4].
2222

23-
The maximum beauty among them is 4.
24-
- For queries[2]=3 and queries[3]=4, the items which can be considered are [1,2], [3,2], [2,4], and [3,5].
23+
The maximum beauty among them is 4.
2524

26-
The maximum beauty among them is 5.
27-
- For queries[4]=5 and queries[5]=6, all items can be considered.
25+
- For queries[2]=3 and queries[3]=4, the items which can be considered are [1,2], [3,2], [2,4], and [3,5].
26+
27+
The maximum beauty among them is 5.
28+
29+
- For queries[4]=5 and queries[5]=6, all items can be considered.
2830

2931
Hence, the answer for them is the maximum beauty of all items, i.e., 6.
3032

@@ -34,7 +36,9 @@ Hence, the answer for them is the maximum beauty of all items, i.e., 6.
3436

3537
**Output:** [4]
3638

37-
**Explanation:** The price of every item is equal to 1, so we choose the item with the maximum beauty 4.
39+
**Explanation:**
40+
41+
The price of every item is equal to 1, so we choose the item with the maximum beauty 4.
3842

3943
Note that multiple items can have the same price and/or beauty.
4044

@@ -44,12 +48,14 @@ Note that multiple items can have the same price and/or beauty.
4448

4549
**Output:** [0]
4650

47-
**Explanation:** No item has a price less than or equal to 5, so no item can be chosen.
51+
**Explanation:**
52+
53+
No item has a price less than or equal to 5, so no item can be chosen.
4854

4955
Hence, the answer to the query is 0.
5056

5157
**Constraints:**
5258

5359
* <code>1 <= items.length, queries.length <= 10<sup>5</sup></code>
5460
* `items[i].length == 2`
55-
* <code>1 <= price<sub>i</sub>, beauty<sub>i</sub>, queries[j] <= 10<sup>9</sup></code>
61+
* <code>1 <= price<sub>i</sub>, beauty<sub>i</sub>, queries[j] <= 10<sup>9</sup></code>

0 commit comments

Comments
 (0)