# Overview

This is a beginner-friendly project that aims to create a problem-set for various Data Structures and Algorithms. Being a programmer, practising on as many problems as possible is a must to hone your DSA knowledge. This is a try to create a repo that contains some good (basic - advanced level) questions with most efficient approaches. I aim to achieve this collaboratively, so feel free to contribute 😊

# Guidelines to be followed:

Whenever you solve any basic -> advance level problem, or a commonly asked one in various coding rounds of hiring process, coding challenges/practice question at any competitive programming platform, you can simultaneously be a part of community 😃

Make sure your file name is the question title(not too long) in CamelCase with single space between words.

Each contributed file must contain the 1️⃣ : problem statement, 2️⃣ brief explainantion of approach and 3️⃣ most efficient (time and space) solution in said order only. Check https://github.com/riddhi-jain/DSAmap/blob/main/Arrays/Count%20Iversions.py as sample. Your solution can be in any programming language 😉

Make sure you generate a PR for the same data structure that relates to your problem most specifically.

Step-1 - Fork the repository (your own copy)

Step-2 - Create new branch (isolates your code)

Step-3 - Commit and push (add changes to your copy of repoitory)

Step-4 - Create Pull Request (contribute to the original repository)

Step-5 - Congratualtions 🎉 (thanks for your contribution 👍 😃 )

Looking forward to your PR 🙃

###### Riddhi Jain
Computer Science Undergrad | 4⭐Python Hackerrank | Machine Learning enthusiast | Learning DSA. • #### Counting bits

Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation of i.

Example :

Input: n = 2 Output: [0,1,1] Explanation: 0 --> 0 1 --> 1 2 --> 10

• #### Bulb Switcher III

There is a room with n bulbs, numbered from 1 to n, arranged in a row from left to right. Initially, all the bulbs are turned off.

At moment k (for k from 0 to n - 1), we turn on the light[k] bulb. A bulb change color to blue only if it is on and all the previous bulbs (to the left) are turned on too.

Return the number of moments in which all turned on bulbs are blue.

Example: Input: light = [3,2,4,1,5] Output: 2 Explanation: All bulbs turned on, are blue at the moment 3, and 4 (index-0).

• #### cannot be cloned

Hi, I want to contribute to this repository. But when I tried to clone it to my system, It showed an error

## error: invalid path 'Arrays/Count More Than n\k Occurances.cpp'

maybe this is because of naming of the above file.

• #### Missing Number

Given an array nums containing n distinct numbers in the range [0, n], return the only number in the range that is missing from the array.

Follow up: Could you implement a solution using only O(1) extra space complexity and O(n) runtime complexity?

Example :

Input: nums = [3,0,1] Output: 2 Explanation: n = 3 since there are 3 numbers, so all numbers are in the range [0,3]. 2 is the missing number in the range since it does not appear in nums.

P.S. This problem belongs to Sorting and Searching category, so raise your PR accordingly.

• #### Solving Issue #35

The Problem described in Issue 35 was solved with the help of procedure as found in Binary Searching That would shrink the range of the numbers with two variable and find the square root of input.

• #### Sqrt(x)

Given a non-negative integer x, compute and return the square root of x.

Since the return type is an integer, the decimal digits are truncated, and only the integer part of the result is returned.

Note: You are not allowed to use any built-in exponent function or operator, such as pow(x, 0.5) or x ** 0.5.

Example: Input: x = 8 Output: 2 Explanation: The square root of 8 is 2.82842..., and since the decimal part is truncated, 2 is returned.

Constraints: 0 <= x <= 2^31 - 1

• #### Detect Loop in a LInkedList

Given a linked list of N nodes. The task is to check if the linked list has a loop. Linked list can contain self loop.

Return true if the linkedlist contains a cycle, else return false.

• #### Binary Tree Level Order Traversal

Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level).

Example:

Input: root = [3,9,20,null,null,15,7] Output: [,[9,20],[15,7]]

• #### Power set

Given an integer array nums that may contain duplicates, return all possible subsets (the power set).

The solution set must not contain duplicate subsets. Return the solution in any order.

Example 1:

Input: nums = [1,2,2] Output: [[],,[1,2],[1,2,2],,[2,2]] Example 2:

Input: nums =  Output: [[],]

• #### Pair Sum

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.

Example 1:

Input: nums = [2,7,11,15], target = 9 Output: [0,1] Output: Because nums + nums == 9, we return [0, 1]. Example 2:

Input: nums = [3,2,4], target = 6 Output: [1,2] Example 3:

Input: nums = [3,3], target = 6 Output: [0,1]

Follow-up: A solution with less than O(n^2) time complexity will be merged.

• #### Maximum Performance of a Team

You are given two integers n and k and two integer arrays speed and efficiency both of length n. There are n engineers numbered from 1 to n. speed[i] and efficiency[i] represent the speed and efficiency of the ith engineer respectively.

Choose at most k different engineers out of the n engineers to form a team with the maximum performance.

The performance of a team is the sum of their engineers' speeds multiplied by the minimum efficiency among their engineers.

Return the maximum performance of this team. Since the answer can be a huge number, return it modulo 109 + 7.

Example 1:

Input: n = 6, speed = [2,10,3,1,5,8], efficiency = [5,4,3,9,7,2], k = 2 Output: 60 Explanation: We have the maximum performance of the team by selecting engineer 2 (with speed=10 and efficiency=4) and engineer 5 (with speed=5 and efficiency=7). That is, performance = (10 + 5) * min(4, 7) = 60.

###### Collection of all the LeetCode problem solutions using different programming languages.

LeetCode Solutions Collection of all the LeetCode problem solutions using different programming languages. To contribute, you can make a file for the

Sep 2, 2022
Dec 26, 2022
###### Competitive Programming Problem Set

Competitive Programming Problem Set Please press ⭐ button if you like this repo ❤ . Your supports will encourage me a lot and help me put more my time

Jan 27, 2022
###### Problem solution of Quera's Problems with different programming language and approach.

Quera-Problem-Solution Problem solution of Quera's Problems with different programming language and approach. How to use Each folder is the category o

Oct 10, 2022
###### Templates, algorithms and data structures implemented and collected for programming contests.

Templates, algorithms and data structures implemented and collected for programming contests.

Jan 2, 2023
###### An open source initiative for implementing and testing algorithms in various programming languages.

Algorithms An open source initiative for implementing and testing algorithms in various programming languages. Contributing The idea here is to learn

Nov 28, 2021
###### A modern day direct port of BOOM 2.02 for modern times. Aiming to tastefully continue the development of BOOM, in the style of TeamTNT.

ReBOOM ReBOOM is a continuation of the BOOM source port, version 2.02. what is it ReBOOM is a source port, directly ported from BOOM 2.02 with additio

Jul 27, 2022
###### Repository of problems and solutions of labsheets used for Data Structures and Algorithms (CS F211) in Semester 2, 2020-21 at BITS Pilani - Hyderabad Campus.

CS F211 Data Structures and Algorithms (BITS Pilani - Hyderabad Campus) This repository contains the problems, solution approaches & explanations and

Oct 31, 2022
###### Algo-Tree is a collection of Algorithms and data structures which are fundamentals to efficient code and good software design

Algo-Tree is a collection of Algorithms and data structures which are fundamentals to efficient code and good software design. Creating and designing excellent algorithms is required for being an exemplary programmer. It contains solutions in various languages such as C++, Python and Java.

Oct 4, 2022
###### 🔗 Common Data Structures and Algorithms

?? Data Structures and Algorithms This library provides common data structures. It will also provide some data structures which needed in render or ga

Dec 10, 2022
###### An assortment of commonly used algorithms and data structures implemented with C++.

Algorithms-And-Data-Structures This repo contains C++ implementations of common algorithms and data structures, grouped by topics. The list will be sp

Nov 9, 2021
###### Wonderful library with lots of useful functions, algorithms and data structures in C, link it with -l9wada

Lib9wada Wonderful library with lots of useful functions, algorithms and data structures in C, link it with -l9wada Usage Compile the library with mak

Nov 21, 2022
###### Wonderful library with lots of useful functions, algorithms and data structures in C, link it with -l9wada

LibC+ Wonderful library with lots of useful functions, algorithms and data structures in C, link it with -lC+ Better than C, not as much as c++ Usage

Nov 21, 2022
###### The aim of this repository is to make it a one final stop for revision for technical interviews involving data structures and algorithms .

Hey ??‍♂️ This repository is meant for data structures and algorithms . I will be updating this often and will include all the data structures importa

Sep 29, 2022
###### Implementation of various data structures and algorithms.

Data Structures and Algorithms A place where you can find and learn the copious number of algorithms in an efficient manner. This repository covers va

Jul 24, 2022
###### Data Structures and Algorithms implemented in C++

OpenOcto - Data Structures and Algorithms Data Structures and Algorithms implemented in C++ Code here directly using Gitpod! Everthing done in C++ All

Dec 27, 2022
###### Data structures and algorithms course, winter 2021/22

Data Structures and Algorithms 2021/22 Repository for the "Data structures and algorithms" course for the 2021/22 academic year. Structure lectures --

Dec 28, 2022
###### A repository by [email protected] for data structures and algorithms

DSA Overview The main goal of this project is to promote open-source, allowing anyone who wants to contribute. This repository would be focused on var

Sep 3, 2022
###### Personal reference material for Data Structures and Algorithms

?? DSA ?? Sr Filename Title Notes 1 2-1_datatypes_and_modifiers.cpp Datatypes and Modifiers Type modifiers explained 2 2-2_input_output.cpp stdin and

Oct 24, 2021