Skip to content

problem solving#153

Merged
mkabhishekdev merged 1 commit into
mainfrom
feat/problem-solving
Jul 3, 2026
Merged

problem solving#153
mkabhishekdev merged 1 commit into
mainfrom
feat/problem-solving

Conversation

@mkabhishekdev

Copy link
Copy Markdown
Owner

No description provided.

@mkabhishekdev mkabhishekdev self-assigned this Jul 3, 2026
Copilot AI review requested due to automatic review settings July 3, 2026 06:39
@mkabhishekdev mkabhishekdev added the enhancement New feature or request label Jul 3, 2026
@mkabhishekdev mkabhishekdev merged commit 3d62ff9 into main Jul 3, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the console entry point to run a new “Practice Set Two” binary search exercise and introduces a corresponding BinarySeachSetTwo implementation under the practice folder.

Changes:

  • Switched Program.Main to instantiate and run the new binary search practice implementation.
  • Added BinarySeachSetTwo.BinarySearchImpl with a binary search routine (currently includes sorting and console output).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
ProblemSolvingFromFirstPrinciples/Program.cs Updates the sample runner to invoke the new Practice Set Two binary search implementation.
ProblemSolvingFromFirstPrinciples/Practice/PracticeSetTwo/BinarySeachSetTwo.cs Adds a new binary search practice class and implementation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


namespace ProblemSolvingFromFirstPrinciples.Practice.PracticeSetTwo
{
public class BinarySeachSetTwo
Comment on lines +1 to +4
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Comment on lines +12 to +15
if(nums.Length == 0)
{
return -1;
}
Comment on lines +17 to +39
int low = 0, mid = -1;
int high = nums.Length - 1;

Array.Sort(nums);

while(low <= high)
{
mid = (low+high)/2;

if(target < nums[mid])
{
high = mid - 1;
}
if(target > nums[mid])
{
low = mid + 1;
}
if(target == nums[mid])
{
Console.WriteLine("The target was found at position: "+mid);
return mid;
}
}
Comment on lines +41 to +43
Console.WriteLine("The target element was not found");

return -1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants