प्रश्न
00:00

18. Next Permutation

मध्यमऐरेGoogleMicrosoft

Given an integer array nums, return its next lexicographically greater permutation.

Return the adjusted nums array for the current judge. The original LeetCode problem requires an in-place update.

उदाहरण 1:

इनपुट: nums = [1,2,3]
आउटपुट: [1,3,2]

उदाहरण 2:

इनपुट: nums = [3,2,1]
आउटपुट: [1,2,3]

सीमाएँ:

  • 1 <= nums.length <= 100
मुख्य कोड मोड
● अपने आप सहेजा गयापंक्ति 1, कॉलम 1