This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.

CPP-Questions-and-Solutions 🎯

This repository aims to solve and create new problems from different spheres of coding, which will serve as a single point access for all the students and learners to get solutions to the problems and a chance to solve problems as well.

You may be a part of this repository by contributing questions or solutions or both to the repository.

Star | Fork 🔗 | Contribute 💻


Finally project is on its way to turn into a website

Website name - CodersArena (Contributed by @Rasika Ghadge during Phase-1 of website creation)


Other contribution opportunities -
Java - Java-Questions-and-Solutions


Refer CONTRIBUTING.md for contribution guidelines


Benefits

  1. Collect 5.5k points and earn your Contribution Certificate
  2. Collect 10k points and become a Collaborator

Points Scheme

Level Points
Level 0 5 Points
Level 1 10 Points
Level 2 20 Points
Level 3 30 Points
Level 4 40 Points
Level 5 50 Points
Level X 80 Points
Level Y 100 Points
Level Z 150 Points

Questions covered 📚

  • Arrays

    • 1D Arrays
    • 2D Arrays
  • Basic Codes

  • Bit Manipulation

  • CodeChef

  • CodeForces

  • Data Structure

    • Graph
      • Directed Graph
      • Undirected Graph
    • Heap
    • Linked List
      • Circular Linked List
      • Doubly Linked List
      • Single Linked List
    • Queue
      • Basic Queue
      • Circular Queue
      • Priority Queue
    • Stack
    • Trees
      • AVL Trees
      • B+ Trees
      • Binary Trees
      • Red Black Trees
  • Dynamic Programming

  • Exception Handling

  • File Handling

  • Game Theory

  • Hackerearth

  • Hackerrank

  • Interview Questions

  • Leet Code

  • OOPs

  • Recursion

  • Searching

  • Sorting

  • String Handling

🌟 Contributors

Top Contributors

Rank Contributor Points Collected
1 - -
2 - -
3 - -

Thanks to these wonderful peoples :

Comments
  • 🔴🟨 Call for Logo Designing - Phase 2 🟨🔴

    🔴🟨 Call for Logo Designing - Phase 2 🟨🔴

    Discussed in https://github.com/SarthakKeshari/CPP-Questions-and-Solutions/discussions/251

    Originally posted by SarthakKeshari October 4, 2021


    Hello team, 👋

    🌄Opening a new way into this project to make it more user-friendly and to start this I wish to have your suggestions. #Letsthinktogether🤩


    There is a requirement of logo for the website that stands perfect with the project content and website name - "CodersArena"(Contributed by @Rasika Ghadge during Phase-1 of website creation)

    I am elated to call upon everyone to design a logo for the website (only one logo per participant). We'll accept logo submissions till 2AM(07/10/2021)

    • The participant whose logo gets selected will get the chance to contribute an image file along with a word file to the repository stating the inspiration and the reason behind creating the contributed logo.
    • The selected participant will be given level 2 tag as well as hacktoberfest-accepted tag for this contribution.

    Submission process - Attach your created logo image in the comment section below

    #️⃣Winning #️⃣EverySuggestionMatters

  • Median of Two Sorted Arrays of Different Sizes

    Median of Two Sorted Arrays of Different Sizes

    Enter your question -

    Given two sorted arrays array1 and array2 of size m and n respectively. Find the median of the two sorted arrays in the best time complexity.

    Enter link to the question(if question belongs to any online platform) -

    https://practice.geeksforgeeks.org/problems/median-of-2-sorted-arrays-of-different-sizes/1#

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    Arrays, Searching

  • Next Greater Element (using Stack)

    Next Greater Element (using Stack)

    Enter your question -

    Given an array arr[ ] of size N having distinct elements, the task is to find the next greater element for each element of the array in order of their appearance in the array. Next greater element of an element in the array is the nearest element on the right which is greater than the current element. If there does not exist next greater of current element, then next greater element for current element is -1. For example, next greater of the last element is always -1.

    Enter link to the question(if question belongs to any online platform) -

    https://practice.geeksforgeeks.org/problems/next-larger-element-1587115620/1

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    Array, Stack

  • Added butterfly Pattern.cpp

    Added butterfly Pattern.cpp

    Issue Id you have worked upon -

    #409

    Briefly explain your program logic -

    I have worked on basic concepts and pattern logics It is made with the help of for loop.

    Screenshots(Attach 2 screenshots of your own input and output) -

    Attach here Input

    Output

    Checklist:

    Eg - If your code follow the below guidelines. Kindly change [] to [x]

    All the conditions should be fulfilled for considering your code for merging -

    [x] I have mentioned the question as comment in my solution file.
    [x] My code follows the guidelines of this project.
    [x] I have performed a self-review of my own code.
    [x] I have commented my code.
    [x] My code gives the correct output.
    [x] I confirm that I have not copied the code from anywhere. In case its found that I have copied I can be banned from the repository.

    [x] I affirm that I strictly follow contributing guidelines and code of conduct.

  • Swap 2

    Swap 2

    Enter your question -

    Write a program to swap two numbers (WITHOUT the help of third variable).

    Enter link to the question(if question belongs to any online platform) -

    No Link

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    Basic

  • Maximum Sum Increasing Subsequence

    Maximum Sum Increasing Subsequence

    Enter your question -

    Given an array of n positive integers. Write a program to find the sum of maximum sum subsequence of the given array such that the integers in the subsequence are sorted in increasing order.

    ##Test cases- Test case 1) For input {1, 101, 2, 3, 100, 4, 5}} output should be 106 because the max sum increasing sequence 1,2,3,100 Because we have find the Maximum Maximum Sum Increasing Subsequence and length of subsequence is 4, Test case 2) For input {3, 4, 5, 10} output should be 3+4+5+10=22 Max longest subsequence is 4.

    Enter link to the question(if question belongs to any online platform) -

    https://practice.geeksforgeeks.org/problems/maximum-sum-increasing-subsequence4749/1

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    Recursion , Dynamic Programming , Array

  • Sort and Print the Boundary Elements of a 2D Matrix

    Sort and Print the Boundary Elements of a 2D Matrix

    Enter your question -

    Write a program in Java to sort the boundary elements of a Two Dimensional Matrix and print the sorted and original matrices.

    Constraints: The program MUST take input from the user for the dimensions of the matrix.

    Enter link to the question(if question belongs to any online platform) -

    N/A

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    Array, Basic

  • Stack Using Linked List

    Stack Using Linked List

    Enter your question -

    Create a stack using linked list.

    Enter link to the question(if question belongs to any online platform) -

    No

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    linked list , stack , functions

  • Find k’th largest element in an array

    Find k’th largest element in an array

    Enter your question -

    Find k’th largest element in an array Input:

    arr = [7, 4, 6, 3, 9, 1] k = 2

    Output:

    The 2nd largest array element is 7

    Enter link to the question(if question belongs to any online platform) -

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    DataStructure, Heap, CPP

  • Longest Increasing Path

    Longest Increasing Path

    Enter your question -

    Given a two-dimensional integer matrix, find the length of the longest strictly increasing path. You can move up, down, left, or right.

    Constraints : n, m ≤ 500 where n and m are the number of rows and columns in matrix

    Example : Input-: matrix = [ [1, 3, 5], [0, 4, 6], [2, 2, 9] ] Output-: 6 Explanation-: The longest path is [0, 1, 3, 5, 6, 9]

    Enter link to the question(if question belongs to any online platform) -

    https://binarysearch.com/problems/Longest-Increasing-Path

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    Dynamic Programming

  • Add All_or_any.cpp

    Add All_or_any.cpp

    Choose your form and fill it -

    1. Form 1(C++ Solution contributors)

    2. Form 2(C++ Documentation Contributors)


    1) Form 1

    Issue Id you have worked upon -

    #503

    Briefly explain your program logic -

    Initially, after taking the input for the number of values, that the user wants to check, I stored the array in s variable. After this, a loop checked if all the numbers are positive and then another nested loop checked for the number of palindrome numbers the array contains. If it contains at least one palindrome number, the output is True, otherwise False. Hence, in this way, I checked for both conditions.

    Screenshots(Attach 2 screenshots of your own input and output) -

    image image


    Checklist:

    Eg - If your code follow the below guidelines. Kindly change [] to [x]

    All the conditions should be fulfilled for considering your code for merging -

    • [x] I have mentioned the question as comment in my solution file.

    • [x] My code follows the guidelines of this project.

    • [x] I have performed a self-review of my own code.

    • [x] I have commented my code.

    • [x] My code gives the correct output.

    • [x] I confirm that I have not copied the code from anywhere. In case its found that I have copied even after successful merge then I can be banned from the repository and hacktoberfest.

    • [x] I affirm that I strictly follow contributing guidelines and code of conduct.


  • Number to Hexadecimal Representation

    Number to Hexadecimal Representation

    Enter your question -

    Given an integer num, return a string representing its hexadecimal representation. For negative integers, two’s complement method is used.

    Enter link to the question(if question belongs to any online platform) -

    https://leetcode.com/problems/convert-a-number-to-hexadecimal/

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    Maths

  • Minimum Stack

    Minimum Stack

    Enter your question -

    Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

    Enter link to the question(if question belongs to any online platform) -

    https://leetcode.com/problems/min-stack/

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    Stack

  • Palindrome Linked List

    Palindrome Linked List

    Enter your question -

    Given head of singly list, return true if list is palindrome.

    Enter link to the question(if question belongs to any online platform) -

    https://leetcode.com/problems/palindrome-linked-list/

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    LinkedList, Two Pointers, Stack

  • Group Anagrams

    Group Anagrams

    Enter your question -

    Given an array of string, need to group anagrams together.

    Enter link to the question(if question belongs to any online platform) -

    https://leetcode.com/problems/group-anagrams/

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    Sorting, String

  • 3 Sum Closest

    3 Sum Closest

    Enter your question -

    Given Target element, find sum of three numbers from an array which is closest to the target element.

    Enter link to the question(if question belongs to any online platform) -

    https://leetcode.com/problems/3sum-closest/

    Tags for the question(eg - Array, Basic, Stack, etc.) -

    Arrays, Two Pointers, Sorting

  • 3 sum closest

    3 sum closest

    Choose your form and fill it -

    1. Form 1(C++ Solution contributors)


    1) Form 1

    Issue Id you have worked upon -

    Given a target element, need to find the sum of exactly three numbers from an array which should be around or equal to that target element.

    Briefly explain your program logic -

    Sort the array provided, then using two pointer approach need to calculate the sum of (currentIndex) + (currentIndex+1) + (RightIndex) and find the absolute difference and keep track of a variable "closest" which will be updated if the resultant value is lower than existing closest value.

    Screenshots(Attach 2 screenshots of your own input and output) -

    Screenshot 2021-10-31 at 2 14 11 AM Screenshot 2021-10-31 at 2 14 37 AM

    Checklist:

    Eg - If your code follow the below guidelines. Kindly change [] to [x]

    All the conditions should be fulfilled for considering your code for merging -

    • [x] I have mentioned the question as comment in my solution file.

    • [x] My code follows the guidelines of this project.

    • [x] I have performed a self-review of my own code.

    • [x] I have commented my code.

    • [x] My code gives the correct output.

    • [x] I confirm that I have not copied the code from anywhere. In case its found that I have copied even after successful merge then I can be banned from the repository and hacktoberfest.

    • [x] I affirm that I strictly follow contributing guidelines and code of conduct.

I am planning to add a beginner friendly path for my Juniors to Learn DSA and I will try to provide solutions of every problem also. We can add codeChef Challenge solutions also

DSA-Path-And-Important-Questions I am planning to add a beginner friendly path for my Juniors to Learn DSA Are you a Newbie in programming and want to

Sep 7, 2022
This repo is for competitive coders. In the readme file you will get the list of questions. You can contribute by adding your solutions or by providing the optimized solutions which are answered already.
This repo is for competitive coders. In the readme file you will get the list of questions. You can contribute by adding your solutions or by providing the optimized solutions which are answered already.

Hello, Problem Solvers !!! ?? What it's about? ??‍?? This repository is for Competitive Coders to get started with Open-source. ?? We have curated a l

Oct 22, 2021
A simple program to solve Math3 book problems.
A simple program to solve Math3 book problems.

MathMan Program This is a simple program to solve Math3 book problems. Explore the docs » View Demo · Report Bug · Request Feature Table of Contents A

Feb 28, 2022
A challenge to solve coding questions of top 6 companies in 30 days
A challenge to solve coding questions of top 6 companies in 30 days

A challenge to solve coding questions of top 6 companies in 30 days. An initiative started by Arsh Goyal. #RevisewithArsh #6Companies30Days

Jun 29, 2022
A single point access to all the solutions of an everyday programmer’s perplexities!

CP-almanac About CP - almanac aims to compile some ready to use algorithms/learnings and will have chapters uncovering some beginners to advanced prob

Jan 8, 2022
A series of important questions with solutions to crack the coding interview and ace it!

Data-Structures-Algorithms-Handbook Ace that coding interview! A series of important questions with solutions to crack the coding interview and ace it

Sep 13, 2022
Solutions for the Questions asked during Reverse Coding 2022.
Solutions for the Questions asked during Reverse Coding 2022.

Reverse Coding 2022 Solutions for the Questions asked during Reverse Coding 2022. This is the Open-Source release of the code used in Reverse Coding 2

Aug 3, 2022
Different Example Programs from different programming languages

Example Programs Don't repeat the same program again. Code Refactoring and Code Cleanup are accepted Name the File According to the Program written in

Jul 16, 2022
The Repository Contains all about Data Structure and Algorithms with Practice problems, series, and resources to follow!

?? The Complete DSA Preparation ?? This repository contains all the DSA (Data-Structures, Algorithms, 450 DSA by Love Babbar Bhaiya,STriver Series ,FA

Jan 8, 2022
This repository consists a set of problems that a beginner can starts with.
This repository consists a set of problems that a beginner can starts with.

Beginner's Coding Sheet ?? ?? This Coding Sheet is provided by SIDDHARTH SINGH on his YouTube Channel. Here are the set of problems with its respectiv

Jan 24, 2022
The repository contains DP problems.

Dyannamic Programming Question :- This repository contains solutions for the CSES Prblem Set Solution of DP seciton as well as different coding platfo

Jan 28, 2022
The Repository Contains the Set Way of Learning Cpplus With the help of programs And Notes.

Preface Since the C++ language varies so heavily between versions (e.g. C++0x, C++11, C++17, etc.), I will preface this cheat sheet by saying that the

May 9, 2022
This repository is build for reviewing the CodingInterviews, Coding in ACM mode with C++.

CodingInterviews(剑指 Offer) 建立这个仓库为了重新复习一下《剑指 Offer》,上传的是ACM模式版本。 如果本仓库对你有任何帮助,请点 ?? 支持,谢谢! ??

Mar 4, 2022
This is the code repository for my book C++20 - Get the Details.
This is the code repository for my book C++20 - Get the Details.

Cpp20 This is the code repository for my book C++20 - Get the Details. It has more than 200 running examples. The names of the directories reflect the

Aug 1, 2022
📘 MIPT University - Olympiad School of Competitive Programming (C++) Curated repository with full explanations, solutions & written lectures collected throughout my academic experience at MIPT school

MIPT - Olympiad School of Competitive Programming (with C++) Outcomes: Studying at this school has allowed be to explore numerous algorithms, data str

Nov 24, 2021
Challenge to solve 90 questions from 6 companies in 30 days. Solved 45/90.

#RevisewithArsh #6Companies30days #dhindhora #stop #procastination #ReviseWithArsh #6Companies30Days Challenge! P.S This can be started anytime in the

Aug 21, 2022
A place where you can learn and practise various Problems and algorithms
A place where you can learn and practise various Problems and algorithms

Problem-Solving Problem solving is an art of solving some real time challenges. And this is a place to get started, you can find many problems to solv

Apr 22, 2022
For C++, help generate a default operator for classes whose components (base classes, data members) have the operator. Hideously intrusive.

C-plus-plus-library-default-operators Helps generate a default operator / member function for classes whose components (base classes, data members) ha

Jul 25, 2018
The C++ Core Guidelines are a set of tried-and-true guidelines, rules, and best practices about coding in C++
The C++ Core Guidelines are a set of tried-and-true guidelines, rules, and best practices about coding in C++

The C++ Core Guidelines are a collaborative effort led by Bjarne Stroustrup, much like the C++ language itself. They are the result of many person-years of discussion and design across a number of organizations. Their design encourages general applicability and broad adoption but they can be freely copied and modified to meet your organization's needs.

Sep 19, 2022