brain

tamnd's digital brain — notes, problems, research

42641 notes

CF 7B - Memory Manager

We are asked to implement a simple memory manager for a linear memory array of size _m_. Each memory cell can either be free or occupied by a block. We are to process a sequence of operations: alloc n, erase x, and defragment.

codeforcescompetitive-programmingimplementation
LeetCode 1364 - Number of Trusted Contacts of a Customer

This problem asks us to analyze relationships between customers, their contacts, and invoices. We are given three tables: Customers, Contacts, and Invoices. The Customers table identifies each customer by customerid along with their name and email.

leetcodemediumdatabase
LeetCode 58 - Length of Last Word

The problem gives us a string s that contains English letters and spaces. Inside this string, words are separated by spaces, and there may also be extra spaces at the beginning or end of the string. Our task is to return the length of the last word in the string.

leetcodeeasystring
LeetCode 1627 - Graph Connectivity With Threshold

The problem gives us n cities labeled from 1 to n. Two cities are directly connected if they share a common divisor that

leetcodehardarraymathunion-findnumber-theory
CF 84A - Toy Army

We have two armies, each containing n soldiers. The value of n is always even. The game lasts exactly three turns: 1. Valera attacks Arcady. 2. Arcady attacks Valera. 3. Valera attacks Arcady again.

codeforcescompetitive-programmingmathnumber-theory
LeetCode 1264 - Page Recommendations

This problem models a small social network with two database tables. The Friendship table stores friendship relationship

leetcodemediumdatabase
LeetCode 248 - Strobogrammatic Number III

The problem asks us to count how many numbers within the inclusive range [low, high] are strobogrammatic. A strobogrammatic number is a number that appears unchanged when rotated 180 degrees.

leetcodehardarraystringrecursion
LeetCode 42 - Trapping Rain Water

The problem gives an array called height, where each element represents the height of a vertical bar in an elevation map. Every bar has width 1. After rainfall, water may become trapped between taller bars. The task is to compute the total amount of water that can be trapped.

leetcodehardarraytwo-pointersdynamic-programmingstackmonotonic-stack
LeetCode 1086 - High Five

The problem asks us to compute the top five average score for each student given a list of [ID, score] pairs. Each ID represents a unique student, and score represents a single score they received.

leetcodeeasyarrayhash-tablesortingheap-(priority-queue)
CF 115B - Lawnmower

We are given a rectangular garden represented as an n×m grid. Each cell contains either grass, which does not require mowing, or weeds, which do. We start at the top-left corner of the garden, always on grass, and initially facing right.

codeforcescompetitive-programminggreedysortings
LeetCode 891 - Sum of Subsequence Widths

The problem asks us to calculate the sum of widths for all non-empty subsequences of a given integer array nums. A subsequence is any sequence derived by removing zero or more elements from the original array while maintaining the order.

leetcodehardarraymathsorting
LeetCode 989 - Add to Array-Form of Integer

The problem is asking us to perform addition between a number represented as an array of digits, num, and an integer k. The array-form of a number represents each digit in left-to-right order, so the first element corresponds to the most significant digit.

leetcodeeasyarraymath
LeetCode 731 - My Calendar II

The problem asks us to design a calendar system that supports booking time intervals while enforcing one important rule: no point in time may be covered by three events simultaneously. Each event is represented as a half open interval [startTime, endTime).

leetcodemediumarraybinary-searchdesignsegment-treeprefix-sumordered-set
CF 44F - BerPaint

We have a rectangular canvas of size W × H. Initially the whole canvas is white. Then several black line segments are drawn on it. After that, a sequence of flood-fill operations is applied. A flood-fill chooses a point and a color.

codeforcescompetitive-programminggeometrygraphs
LeetCode 1185 - Day of the Week

This problem asks us to determine which day of the week corresponds to a given calendar date. The input consists of three integers: - day, representing the day within the month - month, representing the month number from 1 to 12 - year, representing the year We must return the…

leetcodeeasymath
LeetCode 1678 - Goal Parser Interpretation

This problem asks us to interpret a Goal Parser command string. The string command consists of the characters "G", "()",

leetcodeeasystring
LeetCode 1071 - Greatest Common Divisor of Strings

The problem asks us to find the greatest common divisor (GCD) of two strings. In this context, a string t divides another string s if s can be formed by concatenating t multiple times. The goal is to find the largest string x that divides both str1 and str2.

leetcodeeasymathstring
LeetCode 1241 - Number of Comments per Post

This problem asks us to analyze a database table named Submissions and determine how many unique comments belong to each post.

leetcodeeasydatabase
LeetCode 395 - Longest Substring with At Least K Repeating Characters

The problem asks us to find the length of the longest substring in which every character appears at least k times. A substring is a contiguous sequence of characters inside the original string.

leetcodemediumhash-tablestringdivide-and-conquersliding-window
LeetCode 142 - Linked List Cycle II

This problem asks us to determine whether a singly linked list contains a cycle and, if it does, return the exact node where that cycle begins. A linked list is normally a sequence of nodes where each node points to the next one, eventually ending with null.

leetcodemediumhash-tablelinked-listtwo-pointers
LeetCode 897 - Increasing Order Search Tree

This problem gives us the root of a Binary Search Tree, abbreviated as BST, and asks us to rearrange the tree into a very specific form.

leetcodeeasystacktreedepth-first-searchbinary-search-treebinary-tree
LeetCode 1565 - Unique Orders and Customers Per Month

This problem requires analyzing a table of orders to calculate monthly statistics. Specifically, for each unique month present in the Orders table, we need to determine two metrics: the number of unique orders and the number of unique customers whose orders have an invoice…

leetcodeeasydatabase
CF 7D - Palindrome Degree

We are given a string consisting of letters and digits, and we are asked to compute a special measure for every prefix called the _palindrome degree_.

codeforcescompetitive-programminghashingstrings
LeetCode 1574 - Shortest Subarray to be Removed to Make Array Sorted

Please provide the full problem statement or LeetCode number you want the detailed solution guide for. You mentioned Lee

leetcodemediumarraytwo-pointersbinary-searchstackmonotonic-stack
CF 45E - Director

We have two independent lists, one containing names and one containing surnames. Every name must be paired with exactly one surname, and every surname must be used exactly once. After choosing the matching, we print all pairs in one comma-separated line.

codeforcescompetitive-programmingconstructive-algorithmsgreedy
CF 104A - Blackjack

We are given a simplified blackjack scenario where the first card is fixed: the queen of spades, which contributes 10 points. The player wants the sum of this card and a second card to equal a given number n, which ranges from 1 to 25.

codeforcescompetitive-programmingimplementation
CF 106B - Choosing Laptop

Each laptop has four values: processor speed, RAM size, HDD size, and price. A laptop is considered outdated if there exists another laptop that is strictly better in all three technical characteristics at the same time.

codeforcescompetitive-programmingbrute-forceimplementation
LeetCode 594 - Longest Harmonious Subsequence

The problem asks us to find the length of the longest harmonious subsequence in an integer array. A harmonious array is defined as one where the difference between the maximum and minimum values is exactly 1.

leetcodeeasyarrayhash-tablesliding-windowsortingcounting
LeetCode 616 - Add Bold Tag in String

The problem asks us to insert HTML-style bold tags into a string whenever a substring matches any word from a given dictionary of words.

leetcodemediumarrayhash-tablestringtriestring-matching
CF 34B - Sale

Bob is at a sale with a collection of old TVs, each with a price. Some TVs are free, some have positive prices, and some even have negative prices, which means the owner is willing to pay Bob to take them away.

codeforcescompetitive-programminggreedysortings
LeetCode 1296 - Divide Array in Sets of K Consecutive Numbers

The problem gives us an integer array nums and an integer k. We need to determine whether it is possible to divide all n

leetcodemediumarrayhash-tablegreedysorting
LeetCode 1590 - Make Sum Divisible by P

This problem asks us to determine the smallest contiguous subarray we can remove from a given array of positive integers

leetcodemediumarrayhash-tableprefix-sum
LeetCode 417 - Pacific Atlantic Water Flow

The problem gives us a rectangular grid called heights, where each cell represents the elevation of a piece of land. Water can flow from one cell to another if the neighboring cell has a height less than or equal to the current cell.

leetcodemediumarraydepth-first-searchbreadth-first-searchmatrix
LeetCode 2308 - Arrange Table by Gender

The problem asks us to rearrange the rows of a Genders table in a specific repeating order while maintaining internal so

leetcodemediumdatabase
LeetCode 563 - Binary Tree Tilt

The problem asks us to compute the total tilt of an entire binary tree. Every node in the tree has its own tilt, and the final answer is the sum of all individual node tilts.

leetcodeeasytreedepth-first-searchbinary-tree
LeetCode 1606 - Find Servers That Handled Most Number of Requests

The problem presents a simulation scenario involving k servers, each uniquely identified from 0 to k-1. Every server can

leetcodehardarrayheap-(priority-queue)simulationordered-set
LeetCode 293 - Flip Game

This problem is asking us to simulate a single move in a simple two-player game. The input is a string currentState consisting only of '+' and '-' characters.

leetcodeeasystring
LeetCode 1337 - The K Weakest Rows in a Matrix

Here is a comprehensive, detailed solution guide for LeetCode 1337 following your exact instructions. The problem provid

leetcodeeasyarraybinary-searchsortingheap-(priority-queue)matrix
LeetCode 1487 - Making File Names Unique

The problem asks us to simulate how a file system assigns folder names when duplicate names appear. We are given an array names, where names[i] represents the folder name requested at the i-th minute. The file system must ensure that every created folder has a unique name.

leetcodemediumarrayhash-tablestring
LeetCode 1715 - Count Apples and Oranges

This problem asks us to compute the total number of apples and oranges across all boxes, taking into account that some boxes may contain a chest. The Boxes table gives us the count of apples and oranges in each box, and optionally the chestid if a chest is present in that box.

leetcodemediumdatabase
LeetCode 1169 - Invalid Transactions

The problem asks us to identify transactions that are potentially invalid based on two rules. First, any transaction with an amount greater than $1000 is invalid.

leetcodemediumarrayhash-tablestringsorting
CF 47A - Triangular numbers

We are asked to determine if a given positive integer can be represented as a triangular number. Triangular numbers are formed by arranging dots into an equilateral triangle, so the _n_-th triangular number is the sum of the first _n_ positive integers.

codeforcescompetitive-programmingbrute-forcemath
LeetCode 792 - Number of Matching Subsequences

The problem asks us to count how many words in a given list are subsequences of a string s. A subsequence is formed by deleting zero or more characters from the string without changing the order of the remaining characters.

leetcodemediumarrayhash-tablestringbinary-searchdynamic-programmingtriesorting
LeetCode 888 - Fair Candy Swap

The problem gives us two arrays, aliceSizes and bobSizes, representing the candy boxes owned by Alice and Bob. Each element in the arrays is the number of candies in a particular box.

leetcodeeasyarrayhash-tablebinary-searchsorting
LeetCode 746 - Min Cost Climbing Stairs

This problem gives us an array named cost, where each element represents the cost of stepping onto a particular stair. If cost[i] equals 10, that means stepping on stair i requires paying 10. From any stair, we are allowed to move either one step or two steps upward.

leetcodeeasyarraydynamic-programming
LeetCode 1779 - Find Nearest Point That Has the Same X or Y Coordinate

The problem gives your current position on a 2D Cartesian grid as (x, y) and a list of other points. Each point is represented as [ai, bi].

leetcodeeasyarray
LeetCode 544 - Output Contest Matches

The problem asks us to simulate the structure of a playoff tournament bracket. We are given n teams, numbered from 1 to n, where smaller numbers represent stronger teams.

leetcodemediumstringrecursionsimulation
CF 16E - Fish

We have n fish in a lake. Every day, exactly one unordered pair of currently alive fish is chosen uniformly at random. When fish i meets fish j, fish i eats fish j with probability a[i][j], and fish j eats fish i with probability a[j][i] = 1 - a[i][j].

codeforcescompetitive-programmingbitmasksdpprobabilities
LeetCode 699 - Falling Squares

The problem describes a simulation of squares falling onto the X-axis. Each square is represented by two values: - lefti, the X-coordinate of the square's left edge - sideLengthi, the side length of the square A square occupies the interval: When a square falls, it continues…

leetcodehardarraysegment-treeordered-set
CF 5E - Bindian Signalizing

We are given a circular arrangement of hills around a capital. Each hill has a height and a watchman who can send signals via fire. The core question is: how many pairs of watchmen can see each other’s signals?

codeforcescompetitive-programmingdata-structures
LeetCode 521 - Longest Uncommon Subsequence I

The problem asks us to find the length of the longest uncommon subsequence between two strings a and b. To understand the problem clearly, we first need to understand what an uncommon subsequence means.

leetcodeeasystring
LeetCode 349 - Intersection of Two Arrays

The problem gives us two integer arrays, nums1 and nums2, and asks us to return their intersection. The intersection consists of all values that appear in both arrays. However, the result must contain only unique elements, even if a number appears many times in either array.

leetcodeeasyarrayhash-tabletwo-pointersbinary-searchsorting
LeetCode 816 - Ambiguous Coordinates

The problem gives us a compressed string representation of a 2D coordinate. Originally, the coordinate looked something like "(1, 3)" or "(2, 0.5)", but all commas, spaces, and decimal points were removed. Our task is to reconstruct every possible valid original coordinate pair.

leetcodemediumstringbacktrackingenumeration
LeetCode 66 - Plus One

The problem gives us a non-empty array of digits that together represent a large integer. Each element in the array is a single decimal digit, and the digits are stored in left-to-right order from the most significant digit to the least significant digit.

leetcodeeasyarraymath
LeetCode 448 - Find All Numbers Disappeared in an Array

The problem asks us to find all the integers in the range [1, n] that are missing from an input array nums of length n.

leetcodeeasyarrayhash-table
LeetCode 1195 - Fizz Buzz Multithreaded

The problem asks us to coordinate four separate threads so they collectively print the correct Fizz Buzz sequence in order from 1 to n. Unlike the classic single threaded Fizz Buzz problem, this version introduces concurrency.

leetcodemediumconcurrency
LeetCode 922 - Sort Array By Parity II

The problem gives an integer array nums where exactly half of the elements are even numbers and the other half are odd numbers. The task is to rearrange the array so that every even index contains an even number and every odd index contains an odd number.

leetcodeeasyarraytwo-pointerssorting
LeetCode 1831 - Maximum Transaction Each Day

The problem gives us a table named Transactions where each row represents a financial transaction. Every transaction has a unique transactionid, a timestamp stored in the day column, and an integer amount.

leetcodemediumdatabase
LeetCode 1662 - Check If Two String Arrays are Equivalent

The problem gives us two arrays of strings, word1 and word2. Each array represents a single larger string formed by conc

leetcodeeasyarraystring
LeetCode 1743 - Restore the Array From Adjacent Pairs

The problem gives us all adjacent pairs from an unknown array nums, and our task is to reconstruct the original array. Suppose the original array was: The adjacent pairs would be: The important detail is that the pairs can appear in any order and can also be reversed.

leetcodemediumarrayhash-tabledepth-first-search
CF 120G - Boom

We are simulating a simplified version of the party game "Boom" with multiple teams and cards. There are n teams, each with two players. Each player has an ability to explain words (a) and an ability to understand words (b).

codeforcescompetitive-programmingimplementation
LeetCode 974 - Subarray Sums Divisible by K

The problem asks us to count how many non-empty contiguous subarrays have a sum that is divisible by a given integer k. A subarray is any continuous segment of the array. For example, in the array [1,2,3], the subarrays include [1], [2], [3], [1,2], [2,3], and [1,2,3].

leetcodemediumarrayhash-tableprefix-sum
LeetCode 1481 - Least Number of Unique Integers after K Removals

This problem asks us to minimize the number of unique integers in an array after removing exactly k elements. In other words, we are given a list arr and a number k, and we need to strategically remove k elements so that the count of distinct integers left in the array is as…

leetcodemediumarrayhash-tablegreedysortingcounting
CF 98B - Help King

We are asked to simulate a fair random selection of one knight out of n using a coin that can only produce two outcomes. Each coin flip has an equal probability of landing heads or tails.

codeforcescompetitive-programmingimplementationprobabilitiestrees
LeetCode 825 - Friends Of Appropriate Ages

The problem gives us an array ages, where each value represents the age of a person on a social media platform. We must determine how many friend requests are sent between people according to a specific set of rules.

leetcodemediumarraytwo-pointersbinary-searchsorting
CF 39A - C*++ Calculations

We are given an arithmetic expression built from terms involving a single variable a. Every term is one of two forms:

codeforcescompetitive-programmingexpression-parsinggreedy
LeetCode 314 - Binary Tree Vertical Order Traversal

The problem asks us to group the nodes of a binary tree by their vertical columns and return those groups from left to right.

leetcodemediumhash-tabletreedepth-first-searchbreadth-first-searchsortingbinary-tree
LeetCode 808 - Soup Servings

The problem gives us two soups, A and B, each starting with exactly n milliliters. At every turn, one of four serving operations is chosen uniformly at random. Each operation removes different amounts from A and B simultaneously.

leetcodemediummathdynamic-programmingprobability-and-statistics
LeetCode 1792 - Maximum Average Pass Ratio

The problem gives us several classes, where each class is represented as [passi, totali]. The value passi tells us how many students currently pass the exam, while totali tells us the total number of students in that class.

leetcodemediumarraygreedyheap-(priority-queue)
LeetCode 189 - Rotate Array

The problem asks us to rotate a given integer array nums to the right by k steps. In other words, each element of the array should be shifted k positions forward, and the elements that "fall off" the end wrap around to the front of the array.

leetcodemediumarraymathtwo-pointers
LeetCode 1281 - Subtract the Product and Sum of Digits of an Integer

The problem asks us to compute a simple mathematical transformation on the digits of an integer. Given an integer n, we

leetcodeeasymath
CF 99A - Help Far Away Kingdom

We are given a decimal number as a string. The number contains an integer part, then a dot, then a fractional part. The task is to simulate the kingdom's strange rounding rules. The rules are intentionally incomplete.

codeforcescompetitive-programmingstrings
CF 72D - Perse-script

We are asked to evaluate a string expression in a small function-based language. Every string literal is enclosed in quotes, and there are only four types of functions: concat, reverse, and substr in two forms. Each function operates only on strings or integers as indices.

codeforcescompetitive-programming*specialexpression-parsing
LeetCode 525 - Contiguous Array

This problem asks us to find the maximum length of a contiguous subarray in a binary array where the number of 0s and 1s are equal. A contiguous subarray means the elements must appear consecutively in the original array. We are not allowed to rearrange elements or skip indices.

leetcodemediumarrayhash-tableprefix-sum
LeetCode 1635 - Hopper Company Queries I

This problem asks us to generate monthly statistics for the year 2020 using information from three database tables: Driv

leetcodeharddatabase
LeetCode 15 - 3Sum

The problem gives us an integer array nums, and we need to find every unique triplet of numbers whose sum is exactly 0. A triplet consists of three different indices: - i != j - i != k - j != k The values themselves may be equal, but the indices must be different.

leetcodemediumarraytwo-pointerssorting
CF 118E - Bertown roads

We are given a connected undirected graph representing the road network of Bertown, where junctions are nodes and roads are edges.

codeforcescompetitive-programmingdfs-and-similargraphs
LeetCode 1671 - Minimum Number of Removals to Make Mountain Array

This problem asks us to remove the minimum number of elements from an array so that the remaining elements form a valid

leetcodehardarraybinary-searchdynamic-programminggreedy
LeetCode 523 - Continuous Subarray Sum

The problem asks us to determine whether an array contains a continuous subarray whose sum is a multiple of k, while also satisfying an important constraint: the subarray must contain at least two elements.

leetcodemediumarrayhash-tablemathprefix-sum
LeetCode 980 - Unique Paths III

This problem asks us to count the number of valid paths in a grid under very strict movement rules. We are given a matrix where each cell has a special meaning: - 1 is the starting position - 2 is the ending position - 0 is an empty square we may walk on - -1 is an obstacle…

leetcodehardarraybacktrackingbit-manipulationmatrix
LeetCode 77 - Combinations

This problem asks us to generate all possible combinations of size k from the numbers in the inclusive range [1, n].

leetcodemediumbacktracking
CF 37D - Lesson Timetable

Each student group attends exactly two lessons. For a group, the classroom used in the first lesson must not exceed the classroom used in the second lesson.

codeforcescompetitive-programmingcombinatoricsdpmath
LeetCode 1747 - Leetflex Banned Accounts

This problem asks us to identify suspicious accounts in the LogInfo table. Each row represents a login session for a user account, including the account ID, the IP address used during the session, and the login and logout timestamps.

leetcodemediumdatabase
CF 100J - Interval Coloring

We are asked to color a collection of intervals on the number line such that no three intervals with the same color form a "triple overlap pattern.

codeforcescompetitive-programming*specialgreedymath
CF 46A - Ball Game

The children stand in a circle numbered from 1 to n. Child 1 starts with the ball. The first throw moves the ball forward by 1 position, the second throw moves it forward by 2 positions, the third throw by 3 positions, and so on.

codeforcescompetitive-programmingbrute-forceimplementation
LeetCode 1413 - Minimum Value to Get Positive Step by Step Sum

The problem gives us an integer array nums and asks us to determine the minimum positive starting value such that when w

leetcodeeasyarrayprefix-sum
LeetCode 1708 - Largest Subarray Length K

The problem asks us to find the lexicographically largest contiguous subarray of length k from a given array of distinct integers. Two arrays are compared lexicographically.

leetcodeeasyarraygreedy
LeetCode 545 - Boundary of Binary Tree

This problem asks us to compute the boundary traversal of a binary tree in a very specific order. The boundary is formed by combining four parts: 1. The root node 2. The left boundary, excluding leaves 3. All leaf nodes from left to right 4.

leetcodemediumtreedepth-first-searchbinary-tree
LeetCode 885 - Spiral Matrix III

The problem is asking us to generate the coordinates of cells in a 2D grid that we would visit if we started at a given cell (rStart, cStart) and walked in a clockwise spiral pattern.

leetcodemediumarraymatrixsimulation
LeetCode 1815 - Maximum Number of Groups Getting Fresh Donuts

This problem asks us to maximize the number of “happy” customer groups by choosing the best possible ordering of the groups. The donut shop produces donuts in batches of exactly batchSize. A fresh batch starts only when the previous batch has been completely consumed.

leetcodehardarraydynamic-programmingbit-manipulationmemoizationbitmask
LeetCode 184 - Department Highest Salary

The problem asks us to find employees with the highest salary in each department from a company database. The input consists of two relational tables: Employee and Department. The Employee table contains employee details, including id, name, salary, and departmentId.

leetcodemediumdatabase
CF 28B - pSort

We start with an array where position i initially contains value i. Each position also has a fixed jump distance d[i]. A swap is allowed between positions i and j only if |i - j| = d[i].

codeforcescompetitive-programmingdfs-and-similardsugraphs
LeetCode 318 - Maximum Product of Word Lengths

The problem gives us an array of lowercase English words. We need to find two different words such that they do not share any common letters, then return the maximum possible product of their lengths. More formally, for every pair of indices (i, j) where i !

leetcodemediumarraystringbit-manipulation
LeetCode 1503 - Last Moment Before All Ants Fall Out of a Plank

The problem describes a plank of length n on which ants are walking either to the left or to the right at a constant spe

leetcodemediumarraybrainteasersimulation
CF 95A - Hockey

We are given a string representing a hockey team name and a list of forbidden substrings. Our task is to modify the original string so that any letter that is part of a forbidden substring can be replaced with another letter of our choosing.

codeforcescompetitive-programmingimplementationstrings
CF 79D - Password

We start with a row of n panels, all turned OFF. The target password is another configuration where exactly k specific positions must be ON and every other position must remain OFF. One operation chooses a segment of consecutive panels whose length belongs to the array a.

codeforcescompetitive-programmingbitmasksdpshortest-paths
CF 32A - Reconnaissance

We are tasked with counting how many pairs of soldiers in a detachment can form a reconnaissance unit. A unit consists of exactly two soldiers, and the difference in their heights cannot exceed a given threshold _d_.

codeforcescompetitive-programmingbrute-force
CF 12C - Fruits

Valera has a shopping list containing a number of fruits, possibly with duplicates if he wants more than one of the same type. At the market, the stall has _n_ types of fruits and _n_ price tags, but the tags are not yet attached to the fruits.

codeforcescompetitive-programminggreedyimplementationsortings
LeetCode 377 - Combination Sum IV

The problem gives us an array of distinct positive integers called nums and a target integer called target. We must determine how many different ordered sequences of numbers from nums sum exactly to target. The key detail is that order matters.

leetcodemediumarraydynamic-programming
LeetCode 704 - Binary Search

This problem gives us a sorted array of integers named nums and a target integer named target. The array is sorted in ascending order, meaning every element is smaller than the elements that come after it. We must determine whether the target value exists in the array.

leetcodeeasyarraybinary-search