this repository has DSA codes
Given two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0. A subsequence of a string is a new string generated from the original string with some characters (can be none) deleted without changing the relative order of the remaining characters.
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target
You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most significant to least significant in left-to-right order. The large integer does not contain any leading 0's. Increment the large integer by one and return the resulting array of digits.
You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively. Merge nums1 and nums2 into a single array sorted in non-decreasing order. The final sorted array should not be returned by the function, but instead be stored inside the array nums1. To accommodate this, nums1 has a length of m + n, where the first m elements denote the elements that should be merged, and the last n elements are set to 0 and should be ignored. nums2 has a length of n.
Given an array nums of size n, return the majority element.The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array.
Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
Each code file is self-contained and can be compiled and executed independently. Follow these general steps to use the codes:
Clone the repository to your local machine. Navigate to the directory containing the code you want to use. Compile the code using a C++ compiler (g++ for example). Run the compiled executable. Contributing Contributions are welcome! If you have any improvements or new DSA implementations to add, feel free to fork the repository and submit a pull request.
This repository is licensed under the MIT License. See the LICENSE file for more details.