akshitagit / cpp Goto Github PK
View Code? Open in Web Editor NEWRepository for C++/C codes and algos.
Home Page: https://github.com/akshitagupta15june
License: MIT License
Repository for C++/C codes and algos.
Home Page: https://github.com/akshitagupta15june
License: MIT License
Given an integer N, print Pascal Triangle upto N rows.
Input Format
Single integer N.
Constraints
N <= 10
Output Format
Print pascal triangle.
Sample Input
4
Sample Output
1
1 1
1 2 1
1 3 3 1
Take N (number in decimal format). Write a function that converts it to octal format. Print the value returned.
Input Format
Constraints
0 < N <= 1000000000
Output Format
Sample Input
63
Sample Output
77
I would like to add code for Extended Euclid's GCD as a part of Hacktoberfest.
I would like to take this issue as a part of hactoberfest. Please assign me.
I would like to take this issue as a part of hactoberfest.
Add in DailyCode repo of CPP
Take as input S, a string. Write a function that does basic string compression. Print the value returned. E.g. for input “aaabbccds” print out a3b2c2d1s1.
Input Format
A single String S
Constraints
1 < = length of String < = 1000
Output Format
The compressed String.
Sample Input
aaabbccds
Sample Output
a3b2c2d1s1
Explanation
In the given sample test case 'a' is repeated 3 times consecutively, 'b' is repeated twice, 'c' is repeated twice and 'd and 's' occurred only once.
solve the issue using CPP.
provide
codes/algos
Given N positive numbers, your task is to calculate their HCF.
Input Format
First line of input contains a single integer N, second line contains N space separated positive integers whose HCF is to be computed.
Constraints
N <= 10 and all the numbers lie between 1 and 100.
Output Format
Print HCF of N numbers.
Sample Input
3
2 4 6
Sample Output
2
Thanks!
I would like to take this issue as a part of hactoberfest.
add in stack repo
You are given an array of integers A.
You need to tell whether you can choose three numbers such that a+b>=c.
Input Format
First line consists of number of integers N. next line consists of N space separated integers.
Constraints
1 <= N <= 10^5
Output Format
YES or NO
Sample Input
5
1 2 3 4 9
Sample Output
YES
Explanation
you can choose 1+3 >= 4
Solve the question and raise the Pull Requests.
Merge sort is missing in the sorting section, I would like to add it as a part of Hacktoberfest.
Add the algorithms if you find they are not already added in the repositories and create a pull request.
Example :
In sorting/searching repo many algos are not added so add them and raise the pull request.
Happy Coding!!!
Check whether two strings are anagram of each other
add in strings folder
Take N as input. For a value of N=5, we wish to draw the following pattern :
5 4 3 2 1 0 1 2 3 4 5
4 3 2 1 0 1 2 3 4
3 2 1 0 1 2 3
2 1 0 1 2
1 0 1
0
1 0 1
2 1 0 1 2
3 2 1 0 1 2 3
4 3 2 1 0 1 2 3 4
5 4 3 2 1 0 1 2 3 4 5
Input Format
Take N as input.
Constraints
N <= 20
Output Format
Pattern should be printed with a space between every two values.
Sample Input
5
I would like to add Kadane's Algorithm is StandardAlgos section as a part of Hacktoberfest.
Add in RecursionBacktracking repo of CPP
First come first serve
add in standard algos repo
Given a balanced binary tree find sum of all the nodes.
Input Format
First line contains N the number of elements in the tree. Next line contains N space separated elements.
Constraints
0 <= N <= 10^6
-10^7 <= tree.data <= 10^7
Output Format
A single integer : Sum of the tree
Sample Input
3
1 2 3
Sample Output
6
add in stack repo
Add this code in StandardAlgos repo of CPP.
I would like to add bit manipulation codes
Given an array A1, A2 . . . AN what is the size of the largest subset of the array such that the each pair of elements in the subset is coprime.
Input Format
The first line contains an integer N, followed by N numbers in the next line.
Constraints
N<=50 , Ai<=50
Output Format
Output is a single number denoting the size.
Sample Input
5
2 3 2 3 2
Sample Output
2
I would like to take this issue as a part of hactoberfest.
You are given a matrix A of size nxm. Find any suitable integer sequence C of size n such that A[1][c[1]]^A[2][c[2]]^….^A[n][c[n]] is greater than 0. Output Format : IF there is no solution , just print “NIE” , otherwise first print “TAK” and then print configuration.
Input Format
Given a matrix of A of size (n X m)
Constraints
n, m<=500, A[i][j]<1024
Output Format
If there is no solution , just print “NIE” , otherwise first print “TAK” and then print configuration.
Sample Input
3 2
0 0
0 0
0 0
Sample Output
NIE
Given a binary tree , print the nodes in left to right manner as visible from above the tree
Input Format
Level order input for the binary tree will be given.
Constraints
No of nodes in the tree can be less than or equal to 10^7
Output Format
A single line containing space separated integers representing the top view of the tree
Sample Input
1 2 3 4 5 6 -1 -1 -1 -1 -1 -1 -1
Sample Output
4 2 1 3
Explanation
The tree looks like
1
/ \
2 3
/ \ /
4 5 6
When viewed from the top , we would see the nodes 4, 2, 1 and 3.
solve the issue using CPP.
provide
codes/algos
Add in sorting repo of CPP!!
Create a code for sorting in linear time
Write a C++ program to check if a given string of lower case alphabets ('a' to 'z') is a palindrome.
You are packing for a vacation on the sea side and you are going to carry only one bag with capacity S (1 <= S <= 1000). You also have N (1<= N <= 1000) items that you might want to take with you to the sea side. Unfortunately you can not fit all of them in the knapsack so you will have to choose. For each item you are given its size and its value. You want to maximize the total value of all the items you are going to bring. What is this maximum total value?
Input Format
On the first line you are given N and S.
Second line contains N space separated integer where ith integer denotes the size of ith item. Third line contains N space seperated integers where ith integer denotes the value of ith item.
Constraints
1 <= S,N <= 1000
Output Format
Output a single integer showing the maximum value that can be obtained by optimally choosing the items.
Sample Input
5 4
1 2 3 2 2
8 4 0 5 3
Sample Output
13
Explanation
Total capacity = 4.
Pick size 1 with value 8 and size 2 with value 5.
add in sorting folder
PROCESS OF CONTRIBUTION IN THIS REPOSITORY
STAR THIS REPO
FORK THIS REPOSITORY
ADD YOUR CODE IN RESPECTIVE FOLDER
CREATE A PULL REQUEST
AFTER A SIMPLE CHECK I WILL MERGE THE PR
HAPPY CODING AND CONTRIBUTING!!!!
Add in searching sorting repo
add in searching sorting repo
I would like to take this issue as a part of hactoberfest.
I would like to add code for Reverse of Singly Linked List as a part of Hacktoberfest.
Write a program that adds element at the beginning of linked list and displays it.
RAISE ANY ISSUE OF YOUR CHOICE.
Members who will be willing to contribute can raise Pull Requests and they will be merged.
Happy Coding!
PROCESS OF CONTRIBUTION IN THIS REPOSITORY
FORK THIS REPOSITORY
ADD YOUR CODE IN RESPECTIVE FOLDER
CREATE A PULL REQUEST
AFTER A SIMPLE CHECK I WILL MERGE THE PR
HAPPY CODING AND CONTRIBUTING!!!!
Take as input S, a string. Write a function that removes all consecutive duplicates. Print the value returned.
Input Format
String
Constraints
A string of length between 1 to 1000
Output Format
String
Sample Input
aabccba
Sample Output
abcba
Explanation
For the given example, "aabccba", Consecutive Occurrence of a is 2, b is 1, and c is 2.
After removing all of the consecutive occurences, the Final ans will be : - "abcba".
ADD IN STANDARD ALGOS REPO OF CPP
I would like to take this issue as a part of hactoberfest. Please assign me.
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.