Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
85f610f
[honux] programmers h-index
honux77 May 27, 2019
891a6c2
Add 190530 problem
honux77 May 30, 2019
0ee56d3
[소니] 프로그래머스 모의고사 알고리즘 풀이 (#45)
sonypark Jun 3, 2019
0782620
Wangmin 190530 문제풀이 (#57)
Min-92 Jun 3, 2019
92c686a
Su (#46)
jeongyongsu5366 Jun 3, 2019
8a125d3
feat: H index, 모의고사 풀이 (#47)
jeuk817 Jun 3, 2019
008cc18
[ingleby]190527 algorithm (#48)
gminiy Jun 3, 2019
291a605
[190527] H 알고리즘 문제풀이 제출합니다. (#49)
hsycamp Jun 3, 2019
aba7819
[mukeunzi] 190528 모의고사 알고리즘 문제풀이 (#50)
mukeunzi Jun 3, 2019
3f1576c
[ruby] 모의고사 보냅니다. (#52)
ruby413 Jun 3, 2019
380f6d3
Nailer Solve programmers supoja problem (#53)
seongheum-choi Jun 3, 2019
d314a08
[Jake] 190530 달팽이 알고리즘 문제풀이 (#54)
cocahack Jun 3, 2019
21661d8
프로그래머스 - 모의고사 문제 풀이 (#56)
bestdevhyo1225 Jun 3, 2019
7ac73a6
BOJ 1913 snail (#60)
honux77 Jun 3, 2019
8dfe335
달팽이 (#62)
bestdevhyo1225 Jun 10, 2019
8dd49df
Honux (#63)
honux77 Jun 11, 2019
cc9b7a1
[sony] algorithm, programmers findPrimeNumber (#65)
sonypark Jun 12, 2019
12e3a6d
feat: 19년 6월 12일 PS 솔루션 업데이트 (#67)
cocahack Jun 12, 2019
65677ac
[Programmers - 42839] 소수 찾기 문제 풀이 (#66)
bestdevhyo1225 Jun 12, 2019
e0e1e69
Honux (#68)
honux77 Jun 13, 2019
97db8c4
feat: 19년 6월 13일 PS 솔루션 업데이트 (#69)
cocahack Jun 15, 2019
5200d07
수 정렬하기3 (#70)
bestdevhyo1225 Jun 15, 2019
1d384c8
[Sony] BOJ algorithm 10989 (#71)
sonypark Jun 15, 2019
b056159
Honux (#72)
honux77 Jun 15, 2019
ae36b7b
[H] 소수찾기 문제풀이 제출합니다. (#73)
hsycamp Jun 16, 2019
1ecd900
[wangmin] 수 정렬하기 3 (#74)
Min-92 Jun 18, 2019
0a84b12
Honux (#75)
honux77 Jun 18, 2019
5a7e616
Jake 문제 추가 (#77)
honux77 Jun 21, 2019
02a4528
Wangmin 190621 퍼즐 문제풀이 (#78)
Min-92 Jun 24, 2019
a7de04e
퍼즐 문제 풀이 (#80)
bestdevhyo1225 Jun 25, 2019
909c90f
[Jake] 백준 1525번 퍼즐 풀이 (#79)
cocahack Jun 25, 2019
9792fea
[Jake] 백준 2580번 스도쿠 풀이 (#82)
cocahack Jun 27, 2019
89e0b0d
[boj 1525] sony 문제 풀이 (#81)
sonypark Jun 27, 2019
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
6 changes: 0 additions & 6 deletions 190521/k_number.js

This file was deleted.

28 changes: 28 additions & 0 deletions 190523/wangmin/pg42746.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

bool func(string a, string b){
return a+b > b+a ? true : false;
}

string solution(vector<int> numbers) {
string answer = "";
vector<string> str;
for(int i = 0 ; i < numbers.size(); i++){
str.push_back(to_string(numbers[i]));
}

sort(str.begin(), str.end(), func);
for(int i = 0; i < str.size(); i++){
answer += str[i];
}
if(answer[0] == '0'){
return "0";
}

return answer;
}
34 changes: 34 additions & 0 deletions 190524/circus/hIndex.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// 첫번째
function solution(citations) {
var answer = 0;
while (true) {
if (citations.filter(x => { return x > answer }).length > answer) {
answer += 1;
continue;
}
break;
}
return Math.max.apply(null, citations) === 0 ? 0 : answer;
}

// 두번째

function solution(citations) {
citations.sort((a, b) => b - a).unshift(0);
for (var i = citations.length - 1; i >= 0; i--) {
if (citations[i] >= i) return i;
}
}

// 세번째

function solution(citations) {
citations = citations.sort((a, b) => a - b);
while (true) {
if (citations.findIndex(x => x < citations.length) !== -1) {
citations.shift();
} else {
return citations.length;
}
}
}
6 changes: 6 additions & 0 deletions 190524/honux/h-index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function solution(citations) {
citations.sort((a,b) => (b - a));
let i = 0;
while (i + 1 <= citations[i]) i++;
return i;
}
13 changes: 13 additions & 0 deletions 190524/ruby/solution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const solution = (c) => {
c.sort((a,b)=>b-a);
for(let i=0; i<c.length; i++){
if(i+1 > c[i]){
return i
}else if(i+1 === c[i]){
return c[i]
}
}
return c.length
}

console.log(solution([1,1,3,4,8]))
21 changes: 21 additions & 0 deletions 190524/wangmin/pg42747.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

int solution(vector<int> citations) {
int h;
sort(citations.begin(),citations.end());
for(int i = 0; i< citations.size(); i++){
h = citations.size()-i;

if(citations[i] >= h){
return h;
}

}
return 0;
}

17 changes: 17 additions & 0 deletions 190527/H/exam.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
def solution(answers):
person1 = [1, 2, 3, 4, 5]
person2 = [2, 1, 2, 3, 2, 4, 2, 5]
person3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]
count = [0, 0, 0]
result = []
for idx, answer in enumerate(answers):
if answer == person1[idx % len(person1)]:
count[0] += 1
if answer == person2[idx % len(person2)]:
count[1] += 1
if answer == person3[idx % len(person3)]:
count[2] += 1
for idx, c in enumerate(count):
if c == max(count):
result.append(idx+1)
return result
19 changes: 19 additions & 0 deletions 190527/circus/exam.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
function solution(answers) {
var num1 = [1, 2, 3, 4, 5];
var num2 = [2, 1, 2, 3, 2, 4, 2, 5];
var num3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5];
var results = [0, 0, 0];
var winer = [];

answers.forEach((ans, i) => {
if (ans === num1[i % num1.length]) results[0] += 1;
if (ans === num2[i % num2.length]) results[1] += 1;
if (ans === num3[i % num3.length]) results[2] += 1;
})

var max = Math.max(...results);
results.forEach((result, i) => {
if (result === max) winer.push(i + 1);
})
return winer;
}
43 changes: 43 additions & 0 deletions 190527/hyodol/mock_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include <iostream>
#include <vector>
using namespace std;

vector<int> solution(vector<int> answers) {
vector<vector<int> > patterns(3);
patterns[0] = {1, 2, 3, 4, 5};
patterns[1] = {2, 1, 2, 3, 2, 4, 2, 5};
patterns[2] = {3, 3, 1, 1, 2, 2, 4, 4, 5, 5};

int maxCnt = 0;
vector<int> personCnt(3);
for (int i = 0; i < 3; i++) {
int cnt = 0;
int patternsSize = (int)patterns[i].size();
for (int j = 0; j < answers.size(); j++) {
if (answers[j] == patterns[i][j % patternsSize]) cnt++;
}
personCnt[i] = cnt;
maxCnt = max(maxCnt, cnt);
}

vector<int> result;
for (int i = 0; i < 3; i++) {
if (maxCnt == personCnt[i]) result.push_back(i+1);
}
return result;
}

int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);

vector<int> result1 = solution({1, 2, 3, 4, 5});
for (int num : result1) cout << num << " ";
cout << '\n';

vector<int> result2 = solution({1, 3, 2, 4, 2});
for (int num : result2) cout << num << " ";
cout << '\n';

return 0;
}
24 changes: 24 additions & 0 deletions 190527/ingleby/mouigosa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
def solution(answers):
patternA = [1, 2, 3, 4, 5]
patternB = [2, 1, 2, 3, 2, 4, 2, 5]
patternC = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]
i = 0
a = 0
b = 0
c = 0
for s in answers :
if patternA[i%5] == s:
a=a+1
if patternB[i%8] == s:
b=b+1
if patternC[i%10] == s:
c=c+1
i = i+1
answer2 = [a,b,c]
maxt = max(answer2)
answer = []
i = 1
for idx in range(len(answer2)):
if answer2[idx] == maxt:
answer.append(idx + 1)
return answer
21 changes: 21 additions & 0 deletions 190527/mockExam.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
function solution(answers) {
let answer = [];
let supo1 = [1,2,3,4,5];
let supo2 = [2,1,2,3,2,4,2,5];
let supo3 = [3,3,1,1,2,2,4,4,5,5];
let ans1 = howManyCorrect(answers , supo1);
let ans2 = howManyCorrect(answers , supo2);
let ans3 = howManyCorrect(answers , supo3);
let max = Math.max(ans1,ans2,ans3);
if( max === ans1) answer.push(1);
if( max === ans2) answer.push(2);
if( max === ans3) answer.push(3);

return answer;
}

function howManyCorrect(ans , supo) {
return ans.filter(function(v, i){
return v === supo[i % supo.length];
}).length
}
46 changes: 46 additions & 0 deletions 190527/mukeunzi/MockTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import java.util.*;

class Solution {
public int[] solution(int[] answers) {
int way1[] = new int[]{1, 2, 3, 4, 5};
int way2[] = new int[]{2, 1, 2, 3, 2, 4, 2, 5};
int way3[] = new int[]{3, 3, 1, 1, 2, 2, 4, 4, 5, 5};
int cnt[] = new int[3];
int max = 0;
int result[];
List<Integer> answer = new ArrayList<>();

for(int i=0; i<answers.length; i++){
if(way1[i%way1.length] == answers[i]){
cnt[0]++;
}
if(way2[i%way2.length] == answers[i]){
cnt[1]++;
}
if(way3[i%way3.length] == answers[i]){
cnt[2]++;
}
}

max = cnt[0];
if(max < cnt[1]){
max = cnt[1];
}
if(max < cnt[2]){
max = cnt[2];
}

for(int i=0; i<cnt.length; i++){
if(max == cnt[i]){
answer.add(i+1);
}
}

result = new int[answer.size()];
for(int i=0; i<answer.size(); i++){
result[i] = answer.get(i);
}

return result;
}
}
31 changes: 31 additions & 0 deletions 190527/nailer/supoja.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
def solution(answers):
answer = []
x = 0
y = 0
z = 0
d = {}
ySet = [2, 1, 2, 3, 2, 4, 2, 5]
zSet = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]
for i in list(range(len(answers))):
if answers[i] == i % 5 + 1:
x += 1
if answers[i] == ySet[i % 8]:
y += 1
if answers[i] == zSet[i % 10]:
z += 1
if x==y and y==z:
return [1,2,3]
if x>y and x>z:
return [1]
if y>x and y>z:
return [2]
if z>x and z>y:
return [3]
if x==y and y > z:
return [1, 2]
if y==z and z > x:
return [2, 3]
if z==x and x > y:
return [1, 3]

return answer
25 changes: 25 additions & 0 deletions 190527/ruby/solution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const solution = (answers) => {
let answer = [];
const a = [1,2,3,4,5];
const b = [2,1,2,3,2,4,2,5];
const c = [3,3,1,1,2,2,4,4,5,5];
let num = [0,0,0];

answers.forEach((el, i)=>{
if(el === a[i%5]){
num[0] = num[0] + 1;
}
if(el === b[i%8]){
num[1] = num[1] + 1;
}
if(el === c[i%10]){
num[2] = num[2] + 1;
}
})
num.forEach( (el, i) => {
if(el === Math.max(...num)){
answer.push(i+1)
}
})
return answer
}
Loading