본문 바로가기

알고리즘45

Leet Code 1672 public int maximumWealth(int[][] accounts) { // int answer = 0; // int temp = 0; // // accounts= new int[][] {{2,8,7}, {7,1,3},{1,9,5}}; // // for (int[] account : accounts) { // for (int i : account) { // temp += i; // } // if (temp > answer) { // answer = temp; // } // temp = 0; // } // int answer = 0; // for(int i =0;i 2023. 7. 25.
Leet Code 1480 public class LeetCode1480 { /** * * Example 1: * * Input: nums = [1,2,3,4] * Output: [1,3,6,10] * Explanation: Running sum is obtained as follows: [1, 1+2, 1+2+3, 1+2+3+4]. * Example 2: * * Input: nums = [1,1,1,1,1] * Output: [1,2,3,4,5] * Explanation: Running sum is obtained as follows: [1, 1+1, 1+1+1, 1+1+1+1, 1+1+1+1+1]. * Example 3: * * Input: nums = [3,1,2,10,1] * Output: [3,4,6,16,17] */ p.. 2023. 7. 25.
[백준] N과 M (4) [자바/Java] 문제: https://www.acmicpc.net/problem/15652 코드: https://github.com/irerin07/AlgorithmStudyBaek/blob/master/src/baekjoon/baekjoon15652.java package baekjoon; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.util.StringTokenizer; public class baekjoon15652 { static int N; static .. 2020. 7. 19.
[백준] 피보나치 함수 [Java/ 자바] 문제: https://www.acmicpc.net/problem/1003 코드: https://github.com/irerin07/AlgorithmStudyBaek/blob/master/src/baekjoon/baekjoon1003.java package baekjoon; import java.io.*; public class baekjoon1003 { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(Sys.. 2020. 6. 14.
728x90