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

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)
  • 방명록

Algorithms (54)
Plus Minus

Question Given an array of integers, calculate the ratios of its elements that are positive, negative, and zero. Print the decimal value of each fraction on a new line with 6 places after the decimal. 주어진 Array안에서 negative value, positive value 그리고 0 의 수가 array크기에 얼마나 비례하는지 소수점 6자리까지 프린트하는 문제. Example output 0.400000 0.400000 0.200000 Solution let arr = [1, 1, 0, -1, -1]; function diagonalDiffer..

Algorithms 2020. 7. 29. 01:33
Diagonal Difference in JavaScript

Question Given a square matrix, calculate the absolute difference between the sums of its diagonals. 2d array 의 서로 다른 두 개의 대각선 값의 Absolute difference 즉, 절대값을 결과로 보여주는 문제. For example, 1 2 3 4 5 6 9 8 9 (1 + 5 + 9) - (3 + 5+ 9) |15 - 17| the absolute difference is 2. Tip. 0 1 2 0 o x o 1 x o x 2 o x o 필요한 부분이 나오는 배열의 형태를 먼저 적어주고 그 형태가 나올 수 있는 loop의 형태를 고민해 본다. 2d Array는 loop를 적용시키면 Column(세로) 이 순..

Algorithms 2020. 7. 27. 23:38
Calculate the Max minus Min Value in Array

1. Initialize random index for minimum and maximum value. Anyhow it's gonna be updated. 2. To find the max and min element in an array, use Max and Min function. Example Code in Java public class Main{ public static void main(String args[]) { int arr[] = {2,4,3,7,5}; System.out.println(getMinMax(arr)); } public static int getMinMax(int[] arr) { //just set arbitrary index 0,1 for now int min = ar..

Algorithms 2019. 9. 8. 14:43
Get the second smallest element in array

Example Code public class Main{ public static void main(String args[]) { int arr[] = {2,4,1,7,0}; System.out.println(min(arr)); } public static int min(int[] arr){ int min = arr[0]; int sec = arr[1]; for(int i = 0; i

Algorithms 2019. 9. 7. 11:11
Counting Valley

문제 난위도보다 영어해석과 문제 이해가 더 문제였던 문제;; Solution I in Java static int countingValleys(int n, String s) { int level = 0; int valley = 0; for(int i=0; i

Algorithms 2019. 8. 31. 13:04
Comparison performing contains() for ArrayList and HashSet

contains() in HashSet and ArrayList Big-O notation for contains() in HashSet is O(1) which takes constant time and doesn't preserve the order. But, in ArrayList, It takes O(n) which is linear time and ensure the order of the entry. Example Code static int sockMerchant(int n, int[] ar) { Set color = new HashSet(); int pairs = 0; for(int i = 0; i

Algorithms 2019. 8. 31. 08:10
이전 1 ··· 3 4 5 6 7 8 9 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • Object type casting
  • equals()
  • 프로그래머스
  • hackerrank solution
  • code refactoring
  • math.abs
  • repeat()
  • HashMap
  • hackerrank javascript solution
  • math.max
  • C++
  • java
  • substring()
  • ... in Javascript
  • 프로그래머스 알고리즘
  • hackerrank
  • HackerRank Algorithm
  • javascript
  • 알고리즘
  • string class in java
  • compareTo()
  • hackerrank javascript
  • rest parameter
  • easy algorithm
  • 프로그래머스 알고리즘문제
  • algorithm
  • Collection Framework
  • Javascript Algorithm
  • easy javascript algorithm
  • spring boot application
more
«   2025/10   »
일 월 화 수 목 금 토
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

티스토리툴바