Hey Geeks, π€
In our Must Do-DSA Topics module, we covered Arrays in the previous week.
We hope you've learned the concepts and practiced with the practice problems.
Here you can find every topic that we'll be covering every week: https://bit.ly/3fykVe8
In our Must Do-DSA Topics module, we covered Arrays in the previous week.
We hope you've learned the concepts and practiced with the practice problems.
Here you can find every topic that we'll be covering every week: https://bit.ly/3fykVe8
π2
"Problem of the Day"
Solve this question to get points.
Find the sum of all the numbers between the range l and r. Here each number is represented by the sum of its prime factors.
Full Problem: https://bit.ly/3dYohqb
Solve this question to get points.
Find the sum of all the numbers between the range l and r. Here each number is represented by the sum of its prime factors.
Full Problem: https://bit.ly/3dYohqb
practice.geeksforgeeks.org
Modified Numbers and Queries | Practice | GeeksforGeeks
Find the sum of all the numbers between the range l and r. Here each number is represented by the sum of its prime factors.
Note : For example, 6 is represented by 5 because 6 has two prime factors 2 and 3 and 2 + 3 = 5.
Example 1
Note : For example, 6 is represented by 5 because 6 has two prime factors 2 and 3 and 2 + 3 = 5.
Example 1
π₯8π1
Must Do-DSA Topics: Day 5
Searching: The process of finding the desired information from the set of items stored in the form of elements in the computer memory is referred to as 'searching in data structure'.
Find the element that appears once:
Letβs understand this problem where all numbers occur twice except one number which occurs once in a given array.
We will be using two approaches, learn both these approaches: https://bit.ly/3Ebi9FP
Equilibrium index of an array:
The equilibrium index of an array is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes.
Given a sequence arr[] of size n, Write a function int equilibrium(int[] arr, int n) that returns an equilibrium index (if any) or -1 if no equilibrium index exists.
To delve more into it: https://bit.ly/3UQr0Tn
You can find more here: https://bit.ly/3UNBGBW
Searching: The process of finding the desired information from the set of items stored in the form of elements in the computer memory is referred to as 'searching in data structure'.
Find the element that appears once:
Letβs understand this problem where all numbers occur twice except one number which occurs once in a given array.
We will be using two approaches, learn both these approaches: https://bit.ly/3Ebi9FP
Equilibrium index of an array:
The equilibrium index of an array is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes.
Given a sequence arr[] of size n, Write a function int equilibrium(int[] arr, int n) that returns an equilibrium index (if any) or -1 if no equilibrium index exists.
To delve more into it: https://bit.ly/3UQr0Tn
You can find more here: https://bit.ly/3UNBGBW
π2
"Problem of the Day"
Solve this question to get points.
The task is to count all the possible paths from the top left to the bottom right of a m X n matrix with the constraints that from each cell you can either move only to the right or down.
Full Problem: https://bit.ly/3rsdec1
Solve this question to get points.
The task is to count all the possible paths from the top left to the bottom right of a m X n matrix with the constraints that from each cell you can either move only to the right or down.
Full Problem: https://bit.ly/3rsdec1
practice.geeksforgeeks.org
Count all possible paths from top left to bottom right | Practice | GeeksforGeeks
The task is to count all the possible paths from top left to bottom right of a m X n matrix with the constraints that from each cell you can either move only to right or down.
Example 1:
Input: m = 2, n = 2
Output: 2
Example 1:
Input: m = 2, n = 2
Output: 2
Must Do-DSA Topics: Day 6
Leaders in an array: Write a program to print all the LEADERS in the array. An element is a leader if it is greater than all the elements to its right side. And the rightmost element is always a leader. Weβll be solving these approaches using the different approaches.
To understand more in detail: https://bit.ly/3fI5ik7
Ceiling in a sorted array: Given a sorted array and a value x, the ceiling of x is the smallest element in an array greater than or equal to x, and the floor is the greatest element smaller than or equal to x. Assume that the array is sorted in non-decreasing order. Here we have to write efficient functions to find the floor and ceiling of x.
We will be using two approaches:
Approach 1: Linear Search
Approach 2: Binary Search
Find these approaches in detail: https://bit.ly/3e4MRpu
You can find more problems here: https://bit.ly/3UNBGBW
Leaders in an array: Write a program to print all the LEADERS in the array. An element is a leader if it is greater than all the elements to its right side. And the rightmost element is always a leader. Weβll be solving these approaches using the different approaches.
To understand more in detail: https://bit.ly/3fI5ik7
Ceiling in a sorted array: Given a sorted array and a value x, the ceiling of x is the smallest element in an array greater than or equal to x, and the floor is the greatest element smaller than or equal to x. Assume that the array is sorted in non-decreasing order. Here we have to write efficient functions to find the floor and ceiling of x.
We will be using two approaches:
Approach 1: Linear Search
Approach 2: Binary Search
Find these approaches in detail: https://bit.ly/3e4MRpu
You can find more problems here: https://bit.ly/3UNBGBW
π7π₯1
"Problem of the Day"
Solve this question to get points.
Geek has a list Li containing (not necessarily distinct) N words and Q queries. Each query consists of a string x.
Full Problem: https://bit.ly/3fIQjGQ
Solve this question to get points.
Geek has a list Li containing (not necessarily distinct) N words and Q queries. Each query consists of a string x.
Full Problem: https://bit.ly/3fIQjGQ
practice.geeksforgeeks.org
Geek and Strings | Practice | GeeksforGeeks
Geek has a list Li containing (not necessarily distinct) N words and Q queries. Each query consists of a string x. For each query, find how many strings in the List Li has the string x as its prefix.
Example 1:
Input:
N = 5, Q = 5
Example 1:
Input:
N = 5, Q = 5
Must Do-DSA Topics: Day 7
Two Pointers Technique: Two pointers is really an easy and effective technique that is typically used for searching pairs in a sorted array. The algorithm basically uses the fact that the input array is sorted. We start the sum of extreme values (smallest and largest) and conditionally move both pointers.
Understand the Two Pointers Technique: https://bit.ly/3fJTCNL
Find the peak elements: Here you are given an array arr[] of integers, where you have to find a peak element i.e. an element that is not smaller than its neighbors.
Note: For corner elements, we need to consider only one neighbor.
Weβll be using the below approaches:
1) Naive Approach
2) Find a peak element using recursive Binary Search
3) Find a peak element using iterative Binary search
To delve into it: https://bit.ly/3e5fwuK
You can find more problems to understand Searching more here: https://bit.ly/3UNBGBW
Two Pointers Technique: Two pointers is really an easy and effective technique that is typically used for searching pairs in a sorted array. The algorithm basically uses the fact that the input array is sorted. We start the sum of extreme values (smallest and largest) and conditionally move both pointers.
Understand the Two Pointers Technique: https://bit.ly/3fJTCNL
Find the peak elements: Here you are given an array arr[] of integers, where you have to find a peak element i.e. an element that is not smaller than its neighbors.
Note: For corner elements, we need to consider only one neighbor.
Weβll be using the below approaches:
1) Naive Approach
2) Find a peak element using recursive Binary Search
3) Find a peak element using iterative Binary search
To delve into it: https://bit.ly/3e5fwuK
You can find more problems to understand Searching more here: https://bit.ly/3UNBGBW
π₯4π1
"Problem of the Day"
Solve this question to get points.
Given a string S consisting of only lowercase characters. Find the lexicographically smallest string after removing exactly k characters from the string.
Full Problem: https://bit.ly/3RAU3qZ
Solve this question to get points.
Given a string S consisting of only lowercase characters. Find the lexicographically smallest string after removing exactly k characters from the string.
Full Problem: https://bit.ly/3RAU3qZ
practice.geeksforgeeks.org
Lexicographically smallest string | Practice | GeeksforGeeks
Given a string S consisting of only lowercase characters. Find the lexicographically smallest string after removing exactly k characters from the string. But you have to correct the value of k, i.e., if the length of the string is a po
π2
Must Do-DSA Topics: Day 8
Find a fixed point in a given array: Fixed Point in an array is an index i such that arr[i] is equal to i. Now you are Given an array of n distinct integers sorted in ascending order, and you have to write a function that returns a Fixed Point in the array, if there is any Fixed Point present in array, else returns -1.
We will be understanding this problem using the below approaches:
1) Linear Search
2) Binary Search
To delve into this, check now: https://bit.ly/3Ej4pZB
Find all triplets with zero-sum: Here the task is to find triplets in the array whose sum is zero when you are given an array of distinct elements.
We will be using the naive approach here with-
1) Find all triplets with zero-sum using Hashing
2) Find all triplets with zero-sum using Sorting
To get a deep understanding, check this: https://bit.ly/3rALstS
You can find more problems to understand searching more here: https://bit.ly/3UNBGBW
Find a fixed point in a given array: Fixed Point in an array is an index i such that arr[i] is equal to i. Now you are Given an array of n distinct integers sorted in ascending order, and you have to write a function that returns a Fixed Point in the array, if there is any Fixed Point present in array, else returns -1.
We will be understanding this problem using the below approaches:
1) Linear Search
2) Binary Search
To delve into this, check now: https://bit.ly/3Ej4pZB
Find all triplets with zero-sum: Here the task is to find triplets in the array whose sum is zero when you are given an array of distinct elements.
We will be using the naive approach here with-
1) Find all triplets with zero-sum using Hashing
2) Find all triplets with zero-sum using Sorting
To get a deep understanding, check this: https://bit.ly/3rALstS
You can find more problems to understand searching more here: https://bit.ly/3UNBGBW
π7
"Problem of the Day"
Solve this question to get points.
Given the root of a binary tree, flatten the tree into a "linked list":
Full Problem: https://bit.ly/3SI0ppT
Solve this question to get points.
Given the root of a binary tree, flatten the tree into a "linked list":
Full Problem: https://bit.ly/3SI0ppT
practice.geeksforgeeks.org
Flatten binary tree to linked list | Practice | GeeksforGeeks
Given the root of a binary tree, flatten the tree into a "linked list":
The "linked list" should use the same Node class where the right child pointer points to the next node in the list and the left child pointe
The "linked list" should use the same Node class where the right child pointer points to the next node in the list and the left child pointe
π4
Guess the right answer and take home exclusive rewards! π€©
All you need to do is solve the murder mystery and find out who's the killer. πͺ
Happening on Discord. β
Participate Now: https://discord.gg/pjHTwrtQ
P.S. Don't forget to check out #gfg-contest channel.
All you need to do is solve the murder mystery and find out who's the killer. πͺ
Happening on Discord. β
Participate Now: https://discord.gg/pjHTwrtQ
P.S. Don't forget to check out #gfg-contest channel.
"Problem of the Day"
Solve this question to get points.
Given a String S and an integer K. Find the count of all substrings of length K which have exactly K-1 distinct characters.
Full Problem: https://bit.ly/3RJCVzC
Solve this question to get points.
Given a String S and an integer K. Find the count of all substrings of length K which have exactly K-1 distinct characters.
Full Problem: https://bit.ly/3RJCVzC
practice.geeksforgeeks.org
Substrings of length k with k-1 distinct elements | Practice | GeeksforGeeks
Given a String S and an integer K. Find the count of all substrings of length K which have exactly K-1 distinct characters.
Example 1:
Input:
S = "abcc"
K = 2
Output:
1
Explanation:
Possible substrings of length K =
Example 1:
Input:
S = "abcc"
K = 2
Output:
1
Explanation:
Possible substrings of length K =
π1
"Problem of the Day"
Solve this question to get points.
Ishaan has been given a task by his teacher. He needs to find the Nth term of a series.
Full Problem: https://practice.geeksforgeeks.org/problems/help-ishaan5837/1
Solve this question to get points.
Ishaan has been given a task by his teacher. He needs to find the Nth term of a series.
Full Problem: https://practice.geeksforgeeks.org/problems/help-ishaan5837/1
practice.geeksforgeeks.org
Help Ishaan | Practice | GeeksforGeeks
Ishaan has been given a task by his teacher. He needs to find the Nth term of a series. His teacher gives him some examples to help him out (Refer examples below). He is a bit weak in pattern searching so to help him his teacher told him that the Nth
π3
"Problem of the Day"
Solve this question to get points.
You are given a n,m which means the row and column of the 2D matrix and an array of size k denoting the number of operations.
Full Problem: https://bit.ly/3VdnIJT
Solve this question to get points.
You are given a n,m which means the row and column of the 2D matrix and an array of size k denoting the number of operations.
Full Problem: https://bit.ly/3VdnIJT
practice.geeksforgeeks.org
Number Of Islands | Practice | GeeksforGeeks
You are given a n,m which means the row and column of the 2D matrix and an array of size k denoting the number of operations. Matrix elements is 0 if there is water or 1 if there is land. Originally, the 2D matrix is all 0 which means there is
π₯5π1
Must Do-DSA Topics: Day 9
A Sorting Algorithm is used to rearrange a given array or list of elements according to a comparison operator on the elements.
Stability in sorting algorithms: A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input data set. Letβs take a deeper dive into how to make stable sorting algorithms and what needs to be taken care of here: https://bit.ly/3T9Vyh7
Time Complexities of Standard Sorting Algorithms:
Time Complexity is defined as the number of times a particular instruction set is executed rather than the total time taken. It is because the total time taken depends on external factors like the compiler used, the processorβs speed, etc. Find more about types of Time Complexity, Space Complexity, and a quick revision sheet that you may refer to at the last minute here: https://bit.ly/3SV20ZF
You can find everything you need to know here: https://bit.ly/3CiEoHr
A Sorting Algorithm is used to rearrange a given array or list of elements according to a comparison operator on the elements.
Stability in sorting algorithms: A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input data set. Letβs take a deeper dive into how to make stable sorting algorithms and what needs to be taken care of here: https://bit.ly/3T9Vyh7
Time Complexities of Standard Sorting Algorithms:
Time Complexity is defined as the number of times a particular instruction set is executed rather than the total time taken. It is because the total time taken depends on external factors like the compiler used, the processorβs speed, etc. Find more about types of Time Complexity, Space Complexity, and a quick revision sheet that you may refer to at the last minute here: https://bit.ly/3SV20ZF
You can find everything you need to know here: https://bit.ly/3CiEoHr
π6
"Problem of the Day"
Solve this question to get points.
An encoded string (s) is given, the task is to decode it.
Full Problem: https://bit.ly/3Ey4kSa
Solve this question to get points.
An encoded string (s) is given, the task is to decode it.
Full Problem: https://bit.ly/3Ey4kSa
practice.geeksforgeeks.org
Decode the string | Practice | GeeksforGeeks
An encoded string (s) is given, the task is to decode it. The encoding pattern is that the occurance of the string is given at the starting of the string and each string is enclosed by square brackets.
Example 1:
Input: s = 1[b]
Output: b
E
Example 1:
Input: s = 1[b]
Output: b
E
π4β€2π₯2
Media is too big
VIEW IN TELEGRAM
Geek Week is here!!π€©π€©
A weeklong rollercoaster of fun, games, contests, challenges, and HUGE rewards to win!!β¨
The wait is over, mark your calendars πnow from 11th Oct to 17th Oct.
Check it out now: https://bit.ly/3COfSPM
A weeklong rollercoaster of fun, games, contests, challenges, and HUGE rewards to win!!β¨
The wait is over, mark your calendars πnow from 11th Oct to 17th Oct.
Check it out now: https://bit.ly/3COfSPM
"Problem of the Day"
Solve this question to get points.
Given a string w, integer array b, character array x and an integer n. n is the size of array b and array x.
Full Problem: https://practice.geeksforgeeks.org/problems/save-your-life4601/1
Solve this question to get points.
Given a string w, integer array b, character array x and an integer n. n is the size of array b and array x.
Full Problem: https://practice.geeksforgeeks.org/problems/save-your-life4601/1
practice.geeksforgeeks.org
Save Your Life | Practice | GeeksforGeeks
Given a string w, integer array b, character array x and an integer n. n is the size of array b and array x. Find a substring which has the sum of the ASCII values of its every character, as maximum. ASCII values of some cha
π2
Must Do-DSA Topics: Day10
Bitonic Sort: Bitonic Sort is a classic parallel algorithm for sorting. The number of comparisons done by Bitonic sort is more than popular sorting algorithms like Merge Sort. To understand Bitonic Sort, we must first understand what is Bitonic Sequence and how to make a given sequence Bitonic: https://bit.ly/3RPSNAp
Iterative merge Sort: This is an example of stable sorting algorithm, as it doesnot change the relative order of same value. Here you will find how to implement iterative merge sort and how it is different from iterative quick sort. https://bit.ly/3SVh7T3
Pigeonhole Sort: Pigeonhole sorting is a sorting algorithm that is suitable for sorting lists of elements where the number of elements and the number of possible key values are approximately the same. Find the working of this algorithm and comparison with counting sort here: https://bit.ly/3RZPMh4
You can find everything you need to know here: https://bit.ly/3CiEoHr
Bitonic Sort: Bitonic Sort is a classic parallel algorithm for sorting. The number of comparisons done by Bitonic sort is more than popular sorting algorithms like Merge Sort. To understand Bitonic Sort, we must first understand what is Bitonic Sequence and how to make a given sequence Bitonic: https://bit.ly/3RPSNAp
Iterative merge Sort: This is an example of stable sorting algorithm, as it doesnot change the relative order of same value. Here you will find how to implement iterative merge sort and how it is different from iterative quick sort. https://bit.ly/3SVh7T3
Pigeonhole Sort: Pigeonhole sorting is a sorting algorithm that is suitable for sorting lists of elements where the number of elements and the number of possible key values are approximately the same. Find the working of this algorithm and comparison with counting sort here: https://bit.ly/3RZPMh4
You can find everything you need to know here: https://bit.ly/3CiEoHr
π6π₯1