Coder Social home page Coder Social logo

dsc-gtbit / hacktoberfest21-gtbit-competitive Goto Github PK

View Code? Open in Web Editor NEW
2.0 0.0 37.0 314 KB

This repository is for all participants who wants to contribute to hacktoberfest 2021 with competitive programming questions.

C++ 56.63% Python 8.30% Java 35.07%
hacktoberfest

hacktoberfest21-gtbit-competitive's Introduction

HACKTOBERFEST21-GTBIT-COMPETITIVE

This repository is for all participants who wants to contribute to hacktoberfest 2021 with competitive programming questions.

HOW TO CONTRIBUTE TO THIS REPOSITORY?

If you want to contribute to this repository, keep in mind to follow the Guidelines first.

1. Follow the pattern of creating a new issue.

Creating an issues in the described pattern helps us in checking and assigning that issue to you easiy and fast.

2. Check first before creating a new issue, whether the same is already in its respective folder or not.

If you find that the question you want to add is not present in our repository, Create issue and after the issues is assigned, go for it and start contributing. P.S. you can add code to same question only if you are adding code in different language.

3. Push the code in respective folder of Platform name and Language.

Always try to push the code in the respective folder. For ex. if you want to contribute about a question that is present on leetcode, and you are coding in java, then do it in folder leetcode, and then under folder java, by creating a new folder/file name as the question no. followed by question name.

4. What all you can add as contribution:

 i) You can provide codes from 450 DSA sheet of Love Babbar by specifying the question name and question number.
 ii) You can provide extra questions other than the ques from sheet.
 iii) You can provide valid explaination of any topic of DSA.
 iv) You can provide the codes in all three languages i.e. C++,JAVA,PYTHON

hacktoberfest21-gtbit-competitive's People

Contributors

mridul8920 avatar taranjotsingh23 avatar rishabh0906 avatar ayushgarg2002 avatar disha8920 avatar starashdeep avatar anujpunjani avatar japjikalra avatar amandeep1217 avatar simarpreetsingh-019 avatar aayushmaan-rawat avatar agamjyot08 avatar dexterousb avatar jaskiratmokha avatar sejalcodes avatar tanmaysharma17 avatar divas18 avatar prehans avatar ruheej1 avatar ganesh1729ganesh avatar harpreet1602 avatar adarsh0562 avatar 1avneetkaur avatar ayushrajput15 avatar binal02singh avatar coder-2022 avatar nikkilaprakash avatar nikhil822 avatar palakmidha avatar sandeepanm2003 avatar

Stargazers

 avatar  avatar

hacktoberfest21-gtbit-competitive's Issues

Find the "Kth" max and min element of an array

The question is

Given an array arr[] and an integer K where K is smaller than size of array, the task is to find the Kth smallest element in the given array. It is given that all array elements are distinct.

Example 1:

Input:
N = 6
arr[] = 7 10 4 3 20 15
K = 3
Output : 7
Explanation :
3rd smallest element in the given
array is 7.
Example 2:

Input:
N = 5
arr[] = 7 10 4 20 15
K = 4
Output : 15
Explanation :
4th smallest element in the given
array is 15.
Your Task:
You don't have to read input or print anything. Your task is to complete the function kthSmallest() which takes the array arr[], integers l and r denoting the starting and ending index of the array and an integer K as input and returns the Kth smallest element.

Expected Time Complexity: O(n)
Expected Auxiliary Space: O(1)
Constraints:
1 <= N <= 105
1 <= arr[i] <= 105
1 <= K <= N

// The code is

#include<stdio.h>
int kthSmallest(int arr[], int l, int r, int k)
{
int temp;
for(int i=l;i<=(r);i++)
{
for(int j=l;j<=(r);j++)
{
if(arr[j] > arr[j+1])
{
temp = arr[j];
arr[j] = arr[j+1];
arr[j+1] = temp;
}
}
}
for(int i=0;i<=(r);i++)
printf("%d",arr[i]);
return(arr[k-1]);
}
int main()
{
int test_cases;
scanf("%d",&test_cases);
while(test_case--)
{
int number_of_elements;
scanf("%d",&number_of_elements);
for(int i=0;i<number_of_elements;i++)
scanf("%d",&a[i]);
int k;
scanf("%d",&k);
printf("%d", kthSmallest(a,0,number_of_elements-1,k));
printf("\n");
}
return 0;
}

Balanced Binary Tree

Ques is:
Given a binary tree, find if it is height balanced or not.
A tree is height balanced if difference between heights of left and right subtrees is not more than one for all nodes of tree.

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

I want to add its code in CPP, please assign the issue to me and add the hacktoberfest label. Thanks :)

Some error in working tree

error

There is some issue while cloning this repository due to which I was unable to contribute via bash so had to make a pull request via {upload files}.

Right Side Binary Tree View

Question is:

Given a Binary Tree, find Right view of it. Right view of a Binary Tree is set of nodes visible when tree is viewed from right side.

I would like to add the code for it in CPP. Please assign the issue and add the hacktoberfest lable to it, Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.