arnab2001 / dsa Goto Github PK
View Code? Open in Web Editor NEWCollection of DSA problems and solutions
Collection of DSA problems and solutions
I would like to add this code. Please assign it to me.
Given an integer array nums and an integer k, return the kth largest element in the array.
Note that it is the kth largest element in the sorted order, not the kth distinct element.
example: Input: nums = [3,2,1,5,6,4], k = 2
Output: 5
i want to add solution of this problem covering all possible approaches (from sorting to quick select)
I want to add bellman ford algo in C++.
@arnab2001 Please, Assign me
I would like to add this code. Please assign it to me.
Add the code of dfs and bfs.
(DP Problem Using C++)
Given two strings X and Y of lengths m and n respectively, PRINT smallest string which has both, X and Y as its sub-sequences.
Example 1
Input:
X = abcd, Y = xycd
Output: abxycd
Explanation: Shortest Common Supersequence
would be abxycd which is of length 6 and
has both the strings as its subsequences.
// I wanna contribute this to DP folder , Please assign this to me
Printing Prime numbers till a given numbers
Hi, I would like to add maximum area of a rectangle formed only of 1s in the given matrix,
using c++.
Please assign it to me @arnab2001 .
LC. 48. Rotate Image
You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).
You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
Partition problem is to determine whether a given set can be partitioned into two subsets such that the sum of elements in both subsets is the same.
EXAMPLE:
A[ ]= {1, 5, 11, 5}
Output: true (1)
The array can be partitioned as {1, 5, 5} and {11}
A[ ] = {1, 5, 3}
Output: false (0)
The array cannot be partitioned into equal sum sets.
// I wanna contribute this to DP folder , Please assign this to me
I would like to add some recursion questions to this repo like indirect, head, tail, tree Fibonacci recursion.
Will this contribution count in hacktoberfest?
Given two strings ‘X’ and ‘Y’, find the length of the longest common substring.
Input : X = “zxabcdezy”, y = “yzabcdezx”
Output : 6
Explanation:
The longest common substring is “abcdez” and is of length 6.
// I wanna contribute this to DP folder , Please assign this to me
Given a value N, if we want to make change for N cents, and we have a supply of each of C = { C1, C2, .. , Cm} valued coins, how many ways can we make the change if the order of coins doesn’t matter.
Given an integer array A of size N, the task is to divide it into two sets S1 and S2 such that the absolute difference between their sums is minimum and find the minimum difference
EXAMPLE:
Input: N = 4, A[ ] = {1, 6, 11, 5}
Output: 1
Explanation:
Subset1 = {1, 5, 6}, sum of Subset1 = 12
Subset2 = {11}, sum of Subset2 = 11
// I wanna contribute this to DP folder , Please assign this to me
LC. 45. Jump game II
Given an array of non-negative integers nums, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Your goal is to reach the last index in the minimum number of jumps.
You can assume that you can always reach the last index.
Description: Tag Dynamic Programming
: find the sum of maximum sum subsequence of the given array
(DP Problem)
Knapsack with Duplicate Items :
Given a set of N items, each with a weight and a value, and a weight limit W. Find the maximum value of a collection containing any of the N items any number of times so that the total weight is less than or equal to W.
Please assign me.
You are given a number n, representing the count of elements and a given target value as input.
You are required to calculate and print true or false, if there is a subset the elements of which add up to given target or not.
I would like to contribute Pigeonhole Sort in JAVA under the Sorting section.
A has an array of N non-negative integers. A wants to calculate maximum length of contiguous arithmetic subarray.
Arithmetic Subarray is an array that contains at least two integers and the difference between consecutive integers are equal. For example [9,10] , [3,3,3] and [9,7,5,3] arithmetic arrays.
Input: No. of test cases T
integer no N
array A[]
(DP Problem Using C++)
Given two strings X and Y of lengths m and n respectively, find the length of the smallest string which has both, X and Y as its sub-sequences.
Note: X and Y can have both uppercase and lowercase letters.
Example 1
Input:
X = abcd, Y = xycd
Output: 6
Explanation: Shortest Common Supersequence
would be abxycd which is of length 6 and
has both the strings as its subsequences.
Submit any code related to Sorting and searching
add under array/Sorting and Searching/
I want to contribute on this. Please assign me this
Add the naive pattern searching algorithm's implementation.
Longest Common Subsequence using C++ (DP Problem)
( DP Problem)
Given a string, find the length of the longest repeating subsequence such that the two subsequences don't have same string character at the same position, i.e., any i'th character in the two subsequences shouldn't have the same index in the original string.
Example 1:
Input: str = "axxxy"
Output: 2
Explanation: The longest repeating subsequenece
is "xx".
LC. 75. Sort Colors
Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue.
We will use the integers 0, 1, and 2 to represent the color red, white, and blue, respectively.
You must solve this problem without using the library's sort function.
I would like to add wave sort in c++.
Please assign me.
I would like to add Number of Conected Comonents in a graph in c++. Please assign it to me
Given the head of a singly linked list, return true if it is a palindrome.
Finding Number of pairs of strings in an array of strings so that on joining them the resulting string have all vowels
I would like to add this code. Please assign it to me.
(DP Problem Using C++)
Given two strings X and Y of lengths m and n respectively, PRINT LCS of strings X and Y
Example 1
Input:
X = aggtab, Y = gxtxayb
Output: gtab
Explanation: Longest Common Subsequence
would be gtab which is of length 4
// I wanna contribute this to DP folder , Please assign this to me
( DP Problem)
Given two strings str1 and str2. The task is to remove or insert the minimum number of characters from/in str1 so as to transform it into str2. It could be possible that the same character needs to be removed/deleted from one point of str1 and inserted to some another point.
Example 1:
Input: str1 = "heap", str2 = "pea"
Output: 3
Explanation: 2 deletions and 1 insertion
p and h deleted from heap. Then, p is
inserted at the beginning One thing to
note, though p was required yet it was
removed/deleted first from its position
and then it is inserted to some other
position. Thus, p contributes one to the
deletion_count and one to the
insertion_count.
Inorder Preorder Postorder in cpp. Please assign this to me.
I want to add Kruskals algorithm in python
Please assign me the issue
Addition of DSU concept.
Often it is also called Union Find because of its two main operations.
I want to add the implementation details. Also,
I will add a question that involves this concept.
Please accept my improvement and assign me this issue. @arnab2001
Using Dynamic programming.
Given an integer array C where C[i] is the cost of ith step on a staircase. Once we pay the cost, we can either climb one or two steps.
we can either start from the step with index 0, or the step with index 1.
The output will be to return the minimum cost to reach the top of the floor.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.