0% found this document useful (0 votes)
3 views2 pages

Array

The document outlines various searching algorithms, including linear and binary search, with specific tasks such as finding elements, counting occurrences, and checking for duplicates in arrays. It also covers sorting algorithms, two-pointer techniques, sliding window methods, Kadane's algorithm, and bit manipulation strategies. Each section provides links to additional resources and specific coding challenges related to the topics discussed.

Uploaded by

Prerna Bhandari
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Array

The document outlines various searching algorithms, including linear and binary search, with specific tasks such as finding elements, counting occurrences, and checking for duplicates in arrays. It also covers sorting algorithms, two-pointer techniques, sliding window methods, Kadane's algorithm, and bit manipulation strategies. Each section provides links to additional resources and specific coding challenges related to the topics discussed.

Uploaded by

Prerna Bhandari
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

ALL: [Link]

com/c/6971e8f6-995c-8323-bb53-82a2ab101104

[Link]
[Link]

Patterns
[Link]

SEARCHING ALGORITHMS
A. LINEAR SEARCH
1. Find an Element in an Array
Given an array of integers and a target value X, return the index of X if it exists in the array. If
not, return -1.
2. Check if an Element Exists in an Array
Given an array of integers and a value X, determine whether X is present in the array. Return
true if it exists, otherwise false.
A. Count Occurrences of an Element
Given an array of integers and a value X, count the number of times X appears in the array.
B. Find the First Element Greater Than X
Given an array of integers and a value X, find the first element in the array that is strictly
greater than X. If no such element exists, return -1.
C. Find the First Odd Number in an Array
Given an array of integers, find the first odd number present in the array. If no odd number
exists, return -1.
D. Find the First Non-Zero Element
Given an array of integers, find the first element that is not equal to zero. If all elements
are zero, return -1.
E. Find the First Duplicate Element
Given an array of integers, find the first element that appears more than once, where
“first” refers to the element whose second occurrence appears earliest.
F. Find Maximum and Minimum Elements in an Array
Given an array of integers, find the maximum and minimum elements present in the array.
G. Find the First Repeating Element
Given an array of integers, find the first repeating element in the array. An element is
considered repeating if it appears more than once.
H. Check if the Array Contains Duplicates
Given an array of integers, determine whether the array contains any duplicate elements.
Return true if duplicates exist, otherwise false.
I. Find Leader Elements in an Array
Given an array of integers, an element is called a leader if it is greater than all elements
to its right. Find and return all leader elements in the array.
J. Find the Missing Number (Brute Force Approach)
Given an array containing n-1 distinct numbers in the range 1 to n, find the missing number
using a brute force approach.
K. LeetCode 1295 – Find Numbers with Even Number of Digits
Given an array of integers, return the count of numbers that contain an even number of
digits.
L. LeetCode 136 – Single Number
Given a non-empty array of integers where every element appears twice except for one,
find the element that appears only once.
M. Find the Missing Number (Brute Force)
Given an array of integers from 0 to n with one number missing, find the missing number
using a brute force method.
B. BINARY SEARCH
 Binary Search (LC 704)
 Search Insert Position
 First and last position of element
 Count occurrences in sorted array
 Ceiling / Floor of number
 Search insert position
 First bad version
 Capacity to ship packages
 Find smallest divisor
 LC 704 – Binary Search
 LC 34 – First & Last Position
 LC 852 – Peak Index in Mountain Array
 LC 153 – Minimum in Rotated Sorted Array
 LC 875 – Koko Eating Bananas

C. SEARCH IN ROTATED ARRAYS


Search in Rotated Array (No duplicates)👉 LC 33
Search in Rotated Array II (Duplicates)👉 LC 81
Find minimum in rotated array 👉 LC 153 / 154
Count rotations👉 Index of minimum element

SORTING ALGORITHMS
[Link]

TWO POINTER TECHNIQUES


[Link]
Identify
[Link]

SLIDING WINDOW
[Link]
[Link]

KADANE'S ALGORITHMS
[Link]
[Link]

BIT MANIPULATION
[Link]
[Link]

You might also like