This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var i=1; i<=100; i++){ | |
var chk=false; | |
for(var j=2; j<i; j++){ | |
if(i%j===0){ | |
chk=false; | |
break; | |
}else{ | |
chk=true; | |
} | |
}if(i===2){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//1. 홀수 출력 | |
function getOdd(n){ | |
var i = 0; | |
while (i < n) { | |
i++; | |
if(i%2===0){ | |
continue; | |
}console.log(i); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("oh my god"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://developer.mozilla.org/ko/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript | |
function Node(value) { | |
this.element = value | |
this.next = null | |
} | |
function LinkedList() { | |
this.head = null; | |
this.length = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##[grading students](https://www.hackerrank.com/challenges/grading) | |
```javascript | |
function main() { | |
var n = parseInt(readLine()); | |
//console.log(n); | |
for(var i = 0; i < n; i++){ | |
var grade = parseInt(readLine()); | |
// your code goes here | |
if(grade<38){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##[left rotation](https://www.hackerrank.com/challenges/ctci-array-left-rotation) | |
```javascript | |
function main() { | |
var n_temp = readLine().split(' '); | |
var n = parseInt(n_temp[0]); | |
var k = parseInt(n_temp[1]); | |
a = readLine().split(' '); | |
a = a.map(Number); | |
var arr=[1,2,3,4,5] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
var s_temp = readLine().split(' '); | |
var s = parseInt(s_temp[0]); | |
var t = parseInt(s_temp[1]); | |
var a_temp = readLine().split(' '); | |
var a = parseInt(a_temp[0]); | |
var b = parseInt(a_temp[1]); | |
var m_temp = readLine().split(' '); | |
var m = parseInt(m_temp[0]); | |
var n = parseInt(m_temp[1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
var x1_temp = readLine().split(' '); | |
var x1 = parseInt(x1_temp[0]); | |
var v1 = parseInt(x1_temp[1]); | |
var x2 = parseInt(x1_temp[2]); | |
var v2 = parseInt(x1_temp[3]); | |
var n = (x2-x1)/(v1-v2); | |
if(Number.isInteger(n) && n>0){ | |
console.log("YES"); | |
}else{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
var n_temp = readLine().split(' '); | |
var n = parseInt(n_temp[0]); | |
var k = parseInt(n_temp[1]); | |
a = readLine().split(' '); | |
a = a.map(Number); | |
var result=0; | |
for(var i=0; i<n; i++){ | |
for(var j=i+1; j<n; j++){ | |
if((a[i]+a[j])%k==0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
var s = readLine(); | |
var upperNum=0; | |
for(var i=0; i<s.length; i++){ | |
if(s[i] === s[i].toUpperCase()){ | |
upperNum+=1; | |
} | |
} | |
console.log(upperNum+1); | |
} |
OlderNewer