---
title: "Discussion on \"34. Find First and Last Position of Element in Sorted Array\" | Hashnode"
description: "Discussion on \"34. Find First and Last Position of Element in Sorted Array\". Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.\nIf target is not found in the array, return [-1, -1].\nYou must write an algorithm with O(log n) runtime complexity. (link)\n..."
url: "https://hashnode.com/posts/34/65f02006321350f1ca8ea71e"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [34\. Find First and Last Position of Element in Sorted Array](https://chetan77.hashnode.dev/34?utm_source=hashnode&utm_medium=feed)

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. (link) ...

Mar 12, 2024 · 3 min read · chetan77.hashnode.dev  
Read the article

-   [#lower-bound](https://hashnode.com/tag/lower-bound)
-   [#find-first-and-last-position-of-element-in-sorted-array](https://hashnode.com/tag/find-first-and-last-position-of-element-in-sorted-array)
-   [#binary-search](https://hashnode.com/tag/binary-search)
-   [#leetcode](https://hashnode.com/tag/leetcode)
-   [#software-development](https://hashnode.com/tag/software-development)
-   [#java](https://hashnode.com/tag/java)

## Written by

[Chetan Datta](https://hashnode.com/@chetan77)

@chetan77 · Hyderabad, India

  
[View profile](https://hashnode.com/@chetan77)

Software Engineer

I share my learnings here. Thanks for reading.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
