hacktoberfest2020-algorithms-in-cpp's People
Forkers
dikshantmali priyanshusaini akshatsrf i-m-ishika shreyar14 harshit010 chetnaaggarwal-ca yashica-patodia mansig16 sunmeetoberoi ankit039 harshmauny saisyama31 manrexx soumyajitnandi1 nishasingla1 sagar627 arpitgpta tejashrikundem aguywithnojob shubhi2000 kshitij0910 dharya-dev anushkadixit1708 krinal15 arpita938 prachikapatel amitpola yugantar99 sejal1126 vicky-co gaminee aaditya4676 shivangi3001 lucas-c9 swaransh2903hacktoberfest2020-algorithms-in-cpp's Issues
Trapping rain water problem
Given an array arr[] of N non-negative integers representing height of blocks at index i as Ai where the width of each block is 1. Compute how much water can be trapped in between blocks after raining.
Structure is like below:
| |
|_|
We can trap 2 units of water in the middle gap.
Input:
The first line of input contains an integer T denoting the number of test cases. The description of T test cases follows. Each test case contains an integer N denoting the size of the array, followed by N space separated numbers to be stored in array.
Output:
Output the total unit of water trapped in between the blocks.
Constraints:
1 <= T <= 100
3 <= N <= 107
0 <= Ai <= 108
Example:
Input:
2
4
7 4 0 9
3
6 9 9
Output:
10
0
Explanation:
Testcase 1: Water trapped by block of height 4 is 3 units, block of height 0 is 7 units. So, total unit of water trapped is 10 units.
@chandan73933 Can i add this? Please assign this to me.
Merge two sorted linked-lists
Add algorithm code in c++
Merge without extra space
Given two sorted arrays arr1[] of size N and arr2[] of size M. Each array is sorted in non-decreasing order. Merge the two arrays into one sorted array in non-decreasing order without using any extra space.
Example 1:
Input:
N = 4, M = 5
arr1[] = {1, 3, 5, 7}
arr2[] = {0, 2, 6, 8, 9}
Output: 0 1 2 3 5 6 7 8 9
Explanation: Since you can't use any
extra space, modify the given arrays
to form
arr1[] = {0, 1, 2, 3}
arr2[] = {5, 6, 7, 8, 9}
Example 2:
Input:
N = 2, M = 3
arr1[] = {10, 12}
arr2[] = {5, 18, 20}
Output: 5 10 12 18 20
Explanation: Since you can't use any
extra space, modify the given arrays
to form
arr1[] = {5, 10}
arr2[] = {12, 18, 20}
@chandan73933 Can i add this? Please assign this to me.
Quick sort
Given an array of integers. Complete the partition() function used for the implementation of Quick Sort.
Example 1:
Input: N = 5, arr[] = { 4, 1, 3, 9, 7}
Output: 1 3 4 7 9
Example 2:
Input: N = 10,
arr[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}
Output: 1 2 3 4 5 6 7 8 9 10
Expected Time Complexity: O(N).
Expected Auxiliary Space: O(1).
Constraints:
1 <= N <= 103
1 <= arr[i] <= 104
@chandan73933 Can i add this? Please assign this to me.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.