Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding my file #1237

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/Hacktoberfest.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions Hackerrank/Hackerrank/IF_ELSE.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package Hackerrank;

import java.util.*;

public class IF_ELSE {

private static final Scanner scanner = new Scanner(System.in);

public static void main(String[] args) {
int N = scanner.nextInt();
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");

if(N%2!=0){
System.out.print("Weird");

}else if( N%2==0 && N>=2 && N<=5 ){System.out.println("Not Weird");}
else if(N%2==0 && N>=6 && N<=20 ){System.out.println("Weird");}
else if(N%2==0 && N>20){System.out.println("Not Weird");}
scanner.close();
}
}

28 changes: 28 additions & 0 deletions LeetCode/Solution.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package LeetCode;



public class Solution {
public int[] twoSum(int[] nums, int target) {

int a=0;

for (int i = 0; i < nums.length-1; i++) {

if(nums[i]+nums[i+1]==target){
a=i;
break;
}
if(a==i) {
System.out.println("["+a + "," + (a + 1)+"]");
}
}
return new int[]{};

}

public static void main(String[] args) {
Solution s=new Solution();
//s.twoSum();
m }
}
44 changes: 44 additions & 0 deletions out/production/Hacktoberfest/Binary Search.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include<bits/stdc++.h>
using namespace std;
//funtion for implementing binary search
int binarySearch(int *input,int beg,int end,int number){
if(beg>end){
return -1;
}
int mid = (beg+end)/2;
if(number == input[mid]){
return mid;
}
//Search left sub array
if(number<input[mid]){
return binarySearch(input,beg,mid-1,number);
}
//Search right sub array
else{
return binarySearch(input,mid+1,end,number);
}

return -1;
}
//main funtion for calling and control
int main(){
//Size of The Array
int n,number;
cin>>n;
// Create An array Of size n Dynamically
int *input = new int[n];
//Take Input Array in Ascending Order
for(int i=0;i<n;i++){
cin>>input[i];
}
//Take number to be searched
cin>>number;
//call the recursive function
int index = binarySearch(input,0,n-1,number);
if(index!=-1){
cout<<number<<" is found at index: "<<index<<endl;
}else{
cout<<number<<" not found"<<endl;
}
return 0;
}
81 changes: 81 additions & 0 deletions out/production/Hacktoberfest/CandlesCounting.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
https://www.hackerrank.com/challenges/candles-2/problem
*/

#include <bits/stdc++.h>

using namespace std;

vector<string> split_string(string);

/*
* Complete the candlesCounting function below.
*/
int candlesCounting(int k, vector<vector<int>> candles) {
/*
* Write your code here.
*/

}

int main()
{
ofstream fout(getenv("OUTPUT_PATH"));

string nk_temp;
getline(cin, nk_temp);

vector<string> nk = split_string(nk_temp);

int n = stoi(nk[0]);

int k = stoi(nk[1]);

vector<vector<int>> candles(n);
for (int candles_row_itr = 0; candles_row_itr < n; candles_row_itr++) {
candles[candles_row_itr].resize(2);

for (int candles_column_itr = 0; candles_column_itr < 2; candles_column_itr++) {
cin >> candles[candles_row_itr][candles_column_itr];
}

cin.ignore(numeric_limits<streamsize>::max(), '\n');
}

int result = candlesCounting(k, candles);

fout << result << "\n";

fout.close();

return 0;
}

vector<string> split_string(string input_string) {
string::iterator new_end = unique(input_string.begin(), input_string.end(), [] (const char &x, const char &y) {
return x == y and x == ' ';
});

input_string.erase(new_end, input_string.end());

while (input_string[input_string.length() - 1] == ' ') {
input_string.pop_back();
}

vector<string> splits;
char delimiter = ' ';

size_t i = 0;
size_t pos = input_string.find(delimiter);

while (pos != string::npos) {
splits.push_back(input_string.substr(i, pos - i));

i = pos + 1;
pos = input_string.find(delimiter, i);
}

splits.push_back(input_string.substr(i, min(pos, input_string.length()) - i + 1));

return splits;
}
46 changes: 46 additions & 0 deletions out/production/Hacktoberfest/DiscountFinder.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include<iostream>
#include<cmath>
#include<string>

double off(float billPrice, float disc);

int main()
{
system("color 0A");
using namespace std;

float billPrice;

cout << "\nEnter the bill value\n";
cin >> billPrice;

if (billPrice >= 2000)
{
if (billPrice >= 5000)
{
if (billPrice >= 10000)
cout << "\nYou got a discount of 10%. \nYour net payment is " << off(billPrice, 10) << '\n';
else
cout << "\nYou got a discount of 5%. \nYour net payment is " << off(billPrice, 5) << '\n';
}
else
cout << "\nYou got a discount of 2%. \nYour net payment is " << off(billPrice, 2) << '\n';
}
else
cout << "\nSorry! You couldn't receive any discount on this bill. \nYour net payment is " << off(billPrice, 0) << '\n';

system("pause");

return 0;

}

double off(float billPrice, float disc)
{
float netPrice;

netPrice = billPrice - ((billPrice / 100) * disc);

return (netPrice);

}
Loading