Find First and Last Position Problem

Find First and Last Position Problem — ExecCode Easy DSA Practice

Solve the Find First and Last Position problem on ExecCode. Free online easy DSA practice in Binary Search. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given the input needed to solve Find First and Last Position. Your task is to in Find First and Last Position, the goal is to transform, count, or select values according to the exact rule. A sequence of values is given, and order matters. n line, nums line, target line. Return first last or -1 -1.

Examples

Input {"nums": [5, 7, 7, 8, 8, 10], "target": 8}; Output 3 4. Input {"nums": [5, 7, 7, 8, 8, 10], "target": 6}; Output -1 -1. Input {"nums": [1], "target": 1}; Output 0 0

Constraints

0 <= len(nums) <= 10^5; nums sorted

Practice Find First and Last Position free on ExecCode. Browse DSA problems, topic map, and placement guides.