Post by Shahana Shaik
Aspiring software developer | Java Programmer | Web Developer | Cybersecurity Enthusiast | Published Researcher
Hey Connections! š Day 28 of 160 Days of Code š§© Problem Solved: Number of Occurrence š» Language: Java š Platform: GeeksforGeeks ā Result: All test cases passed successfully šÆ š” Key Learning: Even though this simple linear solution works fine, because the array is sorted, we can use binary search to optimize the solution. With binary search, we can find the first occurrence and last occurrence of the target, and calculate the frequency in O(log n) time ā±. š± Sometimes solving in a straightforward way is the first step, then comes optimizing for efficiency š #Day28 #160DaysOfCode #Java #ProblemSolving #GeeksforGeeks #DSA #Arrays #CodingJourney #ShahanaCodes #WomenInTech