Most Beautiful Item for Each Query | Leetcode 2070

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии • 18

  • @untitled6483
    @untitled6483 12 дней назад +1

    Very good explanation with intuition.

  • @pruthvinarayana9568
    @pruthvinarayana9568 12 дней назад

    Thanks for a new perspective , which makes more sense as a learner .

  • @bitlandsaga
    @bitlandsaga 11 дней назад

    Well, I was stuck on this question for two days and was finally able to solve it , but I am amazed by the number of optimizations in your code as compared to mine 😅. Anyways, thanks for such a lovely explanation.

  • @webmaker01
    @webmaker01 12 дней назад

    Thanks sir ji

  • @avantikatripathi7959
    @avantikatripathi7959 12 дней назад

    sir, why do we fix 1 while solving, like items[i][1], we increase the price value but not the beauty value??

    • @techdose4u
      @techdose4u  12 дней назад

      items[i][1] is the beauty value of item number i

  • @SibiRanganathL
    @SibiRanganathL 12 дней назад

    just commenting for you

  • @amanqureshi3222
    @amanqureshi3222 12 дней назад +1

    class Solution {
    public:
    vector maximumBeauty(vector& items, vector& queries) {
    sort(items.begin(),items.end());

    int n=queries.size();
    int m=items.size();

    for(int i=1;i

  • @rajGg-h3g
    @rajGg-h3g 12 дней назад

    if i sort the query and then linear search ?

    • @techdose4u
      @techdose4u  12 дней назад

      That will work too :)
      Sort both and perform linear search on both paralelly using 2 pointer