Skip to content

Instantly share code, notes, and snippets.

View kei9327's full-sized avatar

kei9327

  • 우아한형제들
  • Korea
View GitHub Profile
@kei9327
kei9327 / SimpleArraySum.cpp
Last active May 30, 2019 04:36
HackerRank>Algorithms>Warmup>SimpleArraySum
#include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
/*
* Complete the simpleArraySum function below.
*/
int simpleArraySum(vector<int> ar) {
@kei9327
kei9327 / diagonalDifference.cpp
Created May 31, 2019 03:47
HackerRank>Algorithm>Warmup>Diagonal Difference
#include <bits/stdc++.h>
using namespace std;
// Complete the diagonalDifference function below.
int diagonalDifference(vector<vector<int>> arr) {
int result = 0;
for(int i =0; i < arr.size();i++) {
result += arr[i][i] - arr[i][arr.size()-1 -i];
}
@kei9327
kei9327 / plusMinus.cpp
Created June 3, 2019 02:42
HackerRank>Algorithm>Warmup>PlusMinus
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
vector<string> split_string(string);
// Complete the plusMinus function below.
void plusMinus(vector<int> arr) {
vector<int> result{0,0,0};
@kei9327
kei9327 / staircase.cpp
Created June 5, 2019 02:40
HackerRank>Algorithms>Warmup>Staircase
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
// Complete the staircase function below.
void staircase(int n) {
for (int i=0; i < n; i++) {
for (int j=0; j < n-i-1; j++) printf(" ");
for (int k=0; k < i+1; k++) printf("#");
@kei9327
kei9327 / miniMaxSum.cpp
Created June 7, 2019 02:39
HackerRank>Algorithm>Warmup>miniMaxSum
#include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
void insertionSort(vector<int>& arr) {
int key, j;
for (int i = 1; i < arr.size(); i++) {
@kei9327
kei9327 / birthdayCakeCandles.cpp
Created June 7, 2019 02:54
HackerRank>Algorithm>Warmup>birthdayCakeCandles
#include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
void insertionSort(vector<int>& arr) {
int key, j;
for (int i = 1; i < arr.size(); i++) {
@kei9327
kei9327 / timeConversion.cpp
Created June 11, 2019 01:07
HackerRank>Algorithm>Warmup>timeConversion
#include <bits/stdc++.h>
using namespace std;
string *subTimeString(string s, string str_arr[], int &str_cnt) {
str_cnt = 0;
char *str_buff = new char[s.length()];
strcpy(str_buff, s.c_str());
char *tok = strtok(str_buff, ":");
@kei9327
kei9327 / gradingStudents.cpp
Created June 12, 2019 09:48
HackerRank>Algorithm>implementation> Grading Students
#include <bits/stdc++.h>
using namespace std;
/*
* Complete the gradingStudents function below.
*/
vector<int> gradingStudents(vector<int> grades) {
vector<int> result;
result.reserve(grades.size());
@kei9327
kei9327 / countApplesAndOranges.cpp
Created June 13, 2019 05:06
HackerRank>Algorithm>implementation>CountApplesAndOranges
#include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
// Complete the countApplesAndOranges function below.
void countApplesAndOranges(int s, int t, int a, int b, vector<int> apples, vector<int> oranges) {
int appleCount = 0;
int orangeCount =0;
@kei9327
kei9327 / kangaroo.cpp
Last active June 13, 2019 08:44
HackerRank>Algorithm>implementation>kangaroo
#include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
// Complete the kangaroo function below.
string kangaroo(int x1, int v1, int x2, int v2) {
if (v2 >= v1) {
return "NO";