Tip 1 - Practice At least 250 Questions of DS algo
Tip 2 - Do at least 2 application based projects
Tip 1 : Have some projects on resume.
Tip 2 : Do not put false things on resume.
Tip 3 : Project should clear and crisp
There was 1 round of 180 minutes which contains of 3-4 questions from DSA



The order of subsets is not important.
The order of elements in a particular subset should be in increasing order of the index.
Recursively generate all the subsets and keep track of the sum of the elements in the current subset.
Subsets can be generated in the following way. For every element of the array, there are 2 options:
Include the element in the current subset : If we include the element in the current subset, then we decrease the value of ‘K’ by the value of the element.
Do not include the element in the current subset : There is no effect on the value of ‘K’ and we can simply move onto the next element.
In any step, if the value of ‘K’ becomes 0, then we have found a subset which sums to ‘K’. We store all these subsets and return them.



Input:
str="AABC" k=1
Output:3
Explanation: Replace 'B' with 'A', we will get "AAAC" and the longest substring with same character is "AAA" of length 3.
check for each character of English alphabet (both upper and lower cases one by one). Basically look for maximum length of sub-string that can be formed by each character and whichever character will form the sub-string of maximum length then that length will be our answer.
1) check for maximum length of sub-string that can be formed by every character in a set of 52 characters (From ‘A’ to ‘Z’ and from ‘a’ to ‘z’).
2) For doing this we traverse whole string and whenever we find a different character, we increase the count.
If count becomes greater than k (at right index), we again start from 0th index and if we found different character we will decrease the count.
3) When count will be equal to k (at left index) then at that point the length will be rightIndex-leftIndex+1.
4) repeat this process until we reach at the end of string and at that point we will return the maximum length.
5) do this for all characters and finally return the maximum length.



The graph has no self-edges, no parallel edges.
The graph may not be connected.
A graph is bipartite if the nodes of the graph can be partitioned into two independent sets A and B such that every edge in the graph connects a node in set A and a node in set B.
If ‘N’ = 4, ‘M’ = 5, edgeList = [ [0, 1],[0, 3],[1, 2] ].

Here, you can see that the graph is bipartite as we can divide the nodes in two sets as follows:
setA = [0, 2].
setB = [1, 3].
In the graph, you can see that every edge in the graph connects a node in set A and a node in set B.
Hence, the output is “Yes”.
Following is a simple algorithm to find out whether a given graph is Bipartite or not using Breadth First Search (BFS).
1. Assign RED color to the source vertex (putting into set U).
2. Color all the neighbors with BLUE color (putting into set V).
3. Color all neighbor’s neighbor with RED color (putting into set U).
4. This way, assign color to all vertices such that it satisfies all the constraints of m way coloring problem where m = 2.
5. While assigning colors, if we find a neighbor which is colored with same color as current vertex, then the graph cannot be colored with 2 vertices (or graph is not Bipartite)



The width of each bar is the same and is equal to 1.
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].
Output: 10
Explanation: Refer to the image for better comprehension:

You don't need to print anything. It has already been taken care of. Just implement the given function.
Traverse every array element and find the highest bars on the left and right sides. Take the smaller of two heights. The difference between the smaller height and the height of the current element is the amount of water that can be stored in this array element.
Follow the steps mentioned below to implement the idea:
Traverse the array from start to end:
For every element:
Traverse the array from start to that index and find the maximum height (a) and
Traverse the array from the current index to the end, and find the maximum height (b).
The amount of water that will be stored in this column is min(a,b) – array[i], add this value to the total amount of water stored
Print the total amount of water stored.



A pair ('ARR[i]', 'ARR[j]') is said to be an inversion when:
1. 'ARR[i] > 'ARR[j]'
2. 'i' < 'j'
Where 'i' and 'j' denote the indices ranging from [0, 'N').
The idea is to use a method similar to the merge sort algorithm. Like merge sort, divide the given array into two parts. For each left and right half, count the inversions, and at the end, sum up the inversions from both halves to get the resultant inversions.
Approach ; -
Suppose the number of inversions in the left half and right half of the array (let be inv1 and inv2); what kinds of inversions are not accounted for in Inv1 + Inv2? The answer is – the inversions that need to be counted during the merge step. Therefore, to get the total number of inversions that needs to be added are the number of inversions in the left subarray, right subarray, and merge().



In this problem, I have created a list full of 0’s with size of the max() value of our given array. Now, whenever I encounter any positive value in original array, I change the index value of our list to 1. After that I , we simply iterate through our modified list, the first 0 we encounter, its (index value + 1) should be the answer since index in python starts from 0.



Merge Sort Algorithm -
Merge sort is a Divide and Conquer based Algorithm. It divides the input array into two-parts, until the size of the input array is not ‘1’. In the return part, it will merge two sorted arrays a return a whole merged sorted array.

The above illustrates shows how merge sort works.
It is compulsory to use the ‘Merge Sort’ algorithm.
what is deadlock?
What is a bootstrap program in OS?
What are acid properties?
Difference between delete and trucate.
Different types of Joins in Sql

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
To make an AI less repetitive in a long paragraph, you should increase: