The Skyline Problem || Leetcode

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 พ.ย. 2024
  • Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
    NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. Pepcoding has taken the initiative to provide counselling and learning resources to all curious, skillful and dedicated Indian coders. This video is part of the series to impart industry-level web development and programming skills in the community.
    We also provide professional courses with live classes and placement opportunities.
    For more free study resources and information about the courses, visit: www.pepcoding....
    Have a look at our result: www.pepcoding....
    Follow us on our TH-cam page: / pepcoding
    Follow us on our FB page: / pepcoding
    Follow us on Instagram: / pepcoding
    Follow us on LinkedIn: / pepcoding-education
    Follow us on Pinterest: / _created
    Follow us on Twitter: home
    .
    .
    .
    Happy Programming !!! Pep it up
    .
    .
    .
    #pepcoding #code #coder #codinglife #programming #coding #java #freeresources #datastrucutres #pepcode #competitive #competitiveprogramming #softwareengineer #engineering #engineer

ความคิดเห็น • 33

  • @meme_engineering4521
    @meme_engineering4521 2 ปีที่แล้ว +28

    subhesh sir, please jitna ho sake aap videos bna diya karo, aap ek baar explain kar dete ho toh 2 min mein code ho jaata hai, your explanation literally has magic, liked from 2 accounts

  • @nisargkapadia8548
    @nisargkapadia8548 2 ปีที่แล้ว +8

    For C++ user :
    If you are using priorityQueue in c++ stl u will not be able to solve this problem because there is no remove method in c++ stl priority quque so try to use multiset (not set because in edge test case some buildings start and point are same so make sure to use multiset) so for top element use *object_name.rbegin() and for remove element use find method to find element which u want to delete and after that use erase method thats it you solved problem.

    • @shvmsh20
      @shvmsh20 2 ปีที่แล้ว

      Noted

    • @siddharthsingh420
      @siddharthsingh420 ปีที่แล้ว +1

      CPP Code:
      ```
      vector getSkyline(vector& buildings) {
      vector res;
      multiset pq{0};
      vector points; // {start, -height} {end, height}
      for(auto b : buildings) {
      points.push_back({b[0],-b[2]});
      points.push_back({b[1],b[2]});
      }
      sort(points.begin(),points.end());
      int curHeight = 0;
      for(int i=0;i

  • @deepankerchaudhary7187
    @deepankerchaudhary7187 2 ปีที่แล้ว +1

    You earned a subscriber because of this explanation

  • @piyushlohiya1977
    @piyushlohiya1977 2 ปีที่แล้ว

    great explanation and that trick of using - for starting height

  • @arpanbanejee5143
    @arpanbanejee5143 2 ปีที่แล้ว +4

    Great explanation, covering all the edge cases! Thanks a lot!

    • @Pepcoding
      @Pepcoding  2 ปีที่แล้ว +1

      Glad it was helpful! To watch more videos like this visit nados.pepcoding.com

  • @pratyushprateek2934
    @pratyushprateek2934 2 ปีที่แล้ว

    Amazing explanation ! Thank you !

  • @utsavgupta746
    @utsavgupta746 2 ปีที่แล้ว

    Superb explanation 🙌🙌

  • @RithikAgarwal-e9b
    @RithikAgarwal-e9b 10 หลายเดือนก่อน

    Awsome!!!

  • @naman1062
    @naman1062 2 ปีที่แล้ว

    If start point of two rectangles is common, then sorting height in ascending order will not work I guess. Please correct me if I am wrong.
    For example: {2,-6}, {2,-8}, {4, 6}, {7, 8}.
    Now as heights are in ascending order, skyline would be: [2,6], [2,8], [7,0], right? or am I missing something.

    • @priyadharshanreddyseelam5476
      @priyadharshanreddyseelam5476 2 ปีที่แล้ว

      watch from 20:17

    • @akashkumarsingh5355
      @akashkumarsingh5355 2 ปีที่แล้ว

      u will have negative heights for start so the one with larger numeric value ie 8 will actually become -8 and so -8 < -6 hence u will get 8 height first

    • @namanjain1474
      @namanjain1474 2 ปีที่แล้ว

      Thanks, got it

  • @jagdish_pawar
    @jagdish_pawar 2 ปีที่แล้ว

    this solution is O(N^2) right? but the better approach is in O(NlogN)

  • @vineetgarg9125
    @vineetgarg9125 3 ปีที่แล้ว

    This is awesome explanation. Keep it up.

  • @LegitGamer2345
    @LegitGamer2345 3 ปีที่แล้ว +1

    Awesome explanation sir

  • @dhruvsinghal6451
    @dhruvsinghal6451 2 ปีที่แล้ว +1

    Wonderful explaination

    • @Pepcoding
      @Pepcoding  2 ปีที่แล้ว

      Glad you liked it.
      Keep learning.
      And for better experience and well organised content visit nados.pepcoding.com

  • @rahulaggarwal3977
    @rahulaggarwal3977 9 หลายเดือนก่อน

    Nice

  • @ankitdebnath2597
    @ankitdebnath2597 2 ปีที่แล้ว

    What an explanation.Woaah👍

    • @Pepcoding
      @Pepcoding  2 ปีที่แล้ว

      Glad you liked it.
      For better experience and well organised content sign up on nados.io
      And for being updated follow us on Instagram instagram.com/pepcoding/

  • @OrewaAkashi
    @OrewaAkashi 2 ปีที่แล้ว

    Very good explanation bro 🔥

  • @utkarshsharma1185
    @utkarshsharma1185 2 ปีที่แล้ว

    Thanks a lot sir

  • @girikgarg8
    @girikgarg8 ปีที่แล้ว

    Done!

  • @riyakushwaha4347
    @riyakushwaha4347 2 ปีที่แล้ว

    Wonderful explanation sir

    • @Pepcoding
      @Pepcoding  2 ปีที่แล้ว

      Glad it helped.
      For better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @mickyman753
    @mickyman753 3 ปีที่แล้ว

    jordaar solution

  • @sohaibmansuri279
    @sohaibmansuri279 2 ปีที่แล้ว

    upload code in c++ also

  • @raghavsinghhal5564
    @raghavsinghhal5564 2 ปีที่แล้ว +1

    how to think first time ???

    • @anujpatel307
      @anujpatel307 2 ปีที่แล้ว

      Impossible for first time unless you have seen such question before!

  • @araragikoyomi7186
    @araragikoyomi7186 2 ปีที่แล้ว

    This was a tough one