Sign InCreate Account

Upgrade to Pro

Upgrade Now

Coding Workspace

EditorProjectsPractice QuestionsTimed Mock ExamsFlowcharts

PseudoEditor AI

Pseudocode TutorCode GeneratorCode FixerCode Converter
Back to Problems
PreviousNext

Sign in to run tests against edge cases and save your code automatically.

Problem Description

Medium

Binary Search Step Counter

PROSorting & Searching
Binary Search
1D & 2D Arrays

Write a program that inputs 7 integers which are already sorted in ascending order into an array, then inputs a target value. Use a binary search with `low` as the first index, `high` as the last index and `mid = (low + high) DIV 2`. Count each time the middle item is examined. - If the target is found, output the number of steps taken to find it. - If it is not in the array, output `Not Found`. For example, with the array 2, 5, 8, 12, 16, 23, 38 and a target of 23, the middle items checked are 12 then 23, so the output is 2.

Example Input

2 5 8 12 16 23 38 23

Example Output

2

Success Rate:

0% (0 passed / 0 attempted)

Code

Draft auto-saved

Test Results

Click "Test Code" to evaluate your code against the tests.

Product

For SchoolsOverviewFeaturesFAQ
PseudoEditor

© 2026 PseudoEditor. All rights reserved.