본문 바로가기 메뉴 바로가기

Studying programming

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

Studying programming

검색하기 폼
  • Jimin's Programming (194)
    • Algorithms (54)
    • JavaScript (16)
    • Vue.js (3)
    • Node.js (3)
    • React.js (7)
    • React Native (0)
    • Spring Boot (13)
    • JAVA (58)
    • C++ (17)
    • Programming (19)
    • Computer basics (4)
  • 방명록

Jimin's Programming (194)
The Hurdle Race

Solution in Javascript const k = 4; const height = [1, 6, 3, 5, 2]; function hurdleRace(k, height) { const max = Math.max(...height); if ((max - k) The Hurdle Race | HackerRank Determine the maximum value in an array less a value, limit >= 0. www.hackerrank.com

Algorithms 2020. 9. 25. 21:59
Cats and a Mouse

Solution in Javascript const x = 1; const y = 2; const z = 3; function catAndMouse(x, y, z) { const A = Math.abs(z-x); const B = Math.abs(z-y); if (A B){ console.log('Cat B'); }else if (A === B){ console.log('Mouse C'); } } catAndMouse(x, y, z); Reference www.hackerrank.com/challenges/cats-and-a-mouse/problem

Algorithms 2020. 9. 17. 20:14
Type Conversion in Javascript (number, string)

Javascript는 type을 쓰지 않으니 원치않는 결과를 가질 때가 있는데 이럴때 아주 간단하게 형변환을 하는 방법이 있다. number + string type "" 은 number to string type conversion string * 1 은 string to number conversion Example code let arr = [1, 2, 3]; console.log(typeof arr); //datatype: object console.log(typeof arr[1]); //datatype: number let changeToString = (arr + "").split(","); //number + "": changed to string console.log(changeToStri..

JavaScript 2020. 9. 15. 16:47
Find Digits

Solution I in Javascript function solve(n) { //toString: number to string // 1012 //split: split("")는 string split into an array of substrings //하나하니의 element로 나누기 위해서 기준을 빈칸이없는 ''로 잡는다 // [1,0,1,2] //filter: 전체 element중 조건을 통과한 element로 new array 만든다 return n.toString().split('').filter(i => n % i === 0).length } console.log(solve(1012)); //3 Solution II in Javascript function solve(n) { let st..

Algorithms 2020. 9. 13. 11:30
Bon Appétit

Solution in JavaScript const arr = [3, 10, 2, 9]; const k = 1; const b = 12; function solve(bill, k, b) { bill[k] = 0; // 해당 index를 제외하고 시작. let sum = bill.reduce((x,y) => x + y); // reduce로 전부 sum let each = sum / 2; if(each === b){ console.log('Bon Appetit'); } else { console.log(b - each); } } solve(arr, k, b); //loop해서 k의 index를 제외하는 것 -> 해당 index에 0을 넣기.(이 생각을 내가 왜 못했을까!) Reference www.hack..

Algorithms 2020. 9. 12. 00:17
Birthday Chocolate

Solution in JavaScript const arr = [1, 2, 1, 3, 2]; const d = 3; const m = 2; function birthday(s, d, m) { let result = 0; for (let i = 0; i x + y) === d) { result++; } } //return result; console.log(result); } birthday(arr, d, m); //1. 길이만큼 loop을 돌려야하나? -> 2번 //..

Algorithms 2020. 9. 11. 22:11
이전 1 ··· 4 5 6 7 8 9 10 ··· 33 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • substring()
  • java
  • code refactoring
  • equals()
  • hackerrank javascript solution
  • math.abs
  • HashMap
  • hackerrank
  • repeat()
  • spring boot application
  • hackerrank javascript
  • easy javascript algorithm
  • 프로그래머스 알고리즘
  • algorithm
  • rest parameter
  • 프로그래머스
  • Object type casting
  • string class in java
  • javascript
  • ... in Javascript
  • HackerRank Algorithm
  • math.max
  • Javascript Algorithm
  • Collection Framework
  • hackerrank solution
  • compareTo()
  • easy algorithm
  • 프로그래머스 알고리즘문제
  • 알고리즘
  • C++
more
«   2025/07   »
일 월 화 수 목 금 토
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바