You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| 0034 |[Find First and Last Position of Element in Sorted Array](src/main/js/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/solution.js)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 0 | 100.00
110
+
| 0033 |[Search in Rotated Sorted Array](src/main/js/g0001_0100/s0033_search_in_rotated_sorted_array/solution.js)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 0 | 100.00
| 0034 |[Find First and Last Position of Element in Sorted Array](src/main/js/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/solution.js)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Big_O_Time_O(log_n)_Space_O(1) | 0 | 100.00
| 0034 |[Find First and Last Position of Element in Sorted Array](src/main/js/g0001_0100/s0034_find_first_and_last_position_of_element_in_sorted_array/solution.js)| Medium | Top_100_Liked_Questions, Top_Interview_Questions, Array, Binary_Search, Algorithm_II_Day_1_Binary_Search, Binary_Search_I_Day_5, Big_O_Time_O(log_n)_Space_O(1) | 0 | 100.00
A **permutation** of an array of integers is an arrangement of its members into a sequence or linear order.
6
+
7
+
* For example, for `arr = [1,2,3]`, the following are all the permutations of `arr`: `[1,2,3], [1,3,2], [2, 1, 3], [2, 3, 1], [3,1,2], [3,2,1]`.
8
+
9
+
The **next permutation** of an array of integers is the next lexicographically greater permutation of its integer. More formally, if all the permutations of the array are sorted in one container according to their lexicographical order, then the **next permutation** of that array is the permutation that follows it in the sorted container. If such arrangement is not possible, the array must be rearranged as the lowest possible order (i.e., sorted in ascending order).
10
+
11
+
* For example, the next permutation of `arr = [1,2,3]` is `[1,3,2]`.
12
+
* Similarly, the next permutation of `arr = [2,3,1]` is `[3,1,2]`.
13
+
* While the next permutation of `arr = [3,2,1]` is `[1,2,3]` because `[3,2,1]` does not have a lexicographical larger rearrangement.
14
+
15
+
Given an array of integers `nums`, _find the next permutation of_`nums`.
16
+
17
+
The replacement must be **[in place](http://en.wikipedia.org/wiki/In-place_algorithm)** and use only constant extra memory.
There is an integer array `nums` sorted in ascending order (with **distinct** values).
6
+
7
+
Prior to being passed to your function, `nums` is **possibly rotated** at an unknown pivot index `k` (`1 <= k < nums.length`) such that the resulting array is `[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]` (**0-indexed**). For example, `[0,1,2,4,5,6,7]` might be rotated at pivot index `3` and become `[4,5,6,7,0,1,2]`.
8
+
9
+
Given the array `nums`**after** the possible rotation and an integer `target`, return _the index of_`target`_if it is in_`nums`_, or_`-1`_if it is not in_`nums`.
10
+
11
+
You must write an algorithm with `O(log n)` runtime complexity.
0 commit comments