Can someone re-write this topic?


  • -1
    This post is deleted!

  • -1
    M

    @Harrywithcode said in Can someone re-write this topic?:

    without any explain about how these numbers come from

    I see detailed individual explanations for every single result number. And there are two examples, not just one. Are you talking about a different problem?


  • 1

    @ManuelP No, I am talking about this problem.
    For example. "For number 1 in the first array, the next greater number for it in the second array is 3." Do you think this explanation talks about how the number "3" comes?
    Also, please think about the feeling of a person who don't understand this question. If you are already understand, you must think there is no problem.


  • -1
    M

    @Harrywithcode said in Can someone re-write this topic?:

    For example. "For number 1 in the first array, the next greater number for it in the second array is 3." Do you think this explanation talks about how the number "3" comes?

    Yes. What else could that talk about?


  • 5

    For the first paragraph of this problem description, the last few words "for nums1's elements in the corresponding places of nums2." is totally wrong.
    It should be corresponding value, instead of corresponding place.
    Let's focus on example 1. If you consider it as "corresponding places" then in nums1, the item "1" is in place 1st, the corresponding place in nums2 is item "3", then the next greater number should be "4" because "4" is greater than "3" and "4" is at right side of "3". This is wrong.
    The correct way is "corresponding value". Let's say item "1" in nums1 has a corresponding value in nums2 which is item "1" (same value), and then we consider the next great value of item "1" in nums2, which is "3", because "3" is greater than "1" and "3" is at right side of "1".
    Think about it, and hope this can help someone else. If I am wrong, I will delete it. If I am correct, please update the description of this question. Thank you


  • 0

    @ManuelP The next greater number of it in second array is 3, why 3? Can you explain it to me? Thank you gentleman!


  • 0

    @ManuelP Do you think the sentance said why it is 3? Sorry I can't see any detail, your vision is much better, lol


  • -1
    M

    @Harrywithcode I think "corresponding value" is worse. It's the same value. And places are corresponding by value.

    Not sure why you're asking me for an explanation of the 3 after you already explained it yourself.


  • 0
    K

    thanks for asking. I was confused with the question too until I saw your post.


  • 1
    C

    It seems the problem can be stated as two parts:

    1. find the number corresponding number in nums2
    2. determine if the next number is greater? (False)

    e.g.
    nums1 = [4, 1, 2] nums2 = [1, 3, 4, 2]

    -for '4'

    1. find the number '4' in nums2, that is the 3rd number,
    2. determine the next number '2' is greater? (False)
      output -1

    -for '1'

    1. find the number '1' in nums2, that is the 1st number,
    2. determine the next number '3' is greater? (True)
      output 3

    -for '2'

    1. find the number '2' in nums2, that is the 4th number,
    2. There is nothing behind 2 (False)
      output -1

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.