From 2c8dae7dbd4a00a4fa8eef898763fe0b1a849bb4 Mon Sep 17 00:00:00 2001 From: Deven <63876261+devenperez@users.noreply.github.com> Date: Sun, 1 Jan 2023 19:47:51 -0500 Subject: [PATCH] Create README - LeetHub --- .../README.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 34-find-first-and-last-position-of-element-in-sorted-array/README.md diff --git a/34-find-first-and-last-position-of-element-in-sorted-array/README.md b/34-find-first-and-last-position-of-element-in-sorted-array/README.md new file mode 100644 index 0000000..3ba57ee --- /dev/null +++ b/34-find-first-and-last-position-of-element-in-sorted-array/README.md @@ -0,0 +1,27 @@ +
Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.
If target is not found in the array, return [-1, -1].
You must write an algorithm with O(log n) runtime complexity.
+
Example 1:
+Input: nums = [5,7,7,8,8,10], target = 8 +Output: [3,4] +
Example 2:
+Input: nums = [5,7,7,8,8,10], target = 6 +Output: [-1,-1] +
Example 3:
+Input: nums = [], target = 0 +Output: [-1,-1] ++
+
Constraints:
+ +0 <= nums.length <= 105-109 <= nums[i] <= 109nums is a non-decreasing array.-109 <= target <= 109