728x90
๋ก์ง ํ๋ฆ
//[1] Initialize
//[2] Input
//[3] Process : MAX
//[4] Output
์๋ฐ
public class App {
public static void main(String[] args) throws Exception {
//[1] Initialize
int max = Integer.MIN_VALUE;
//[2] Input
int[] nums = {3,56,65,2,2,3,3};
//[3] Process : MAX
for(int x : nums) {
if(x > max){
max = x;
}
}
//[4] Output
System.out.println(max);
}
}
ํ์ด์ฌ
nums = [3,56,65,2,2,3,3]
max = 0
for x in range(len(nums)):
if nums[x] > max :
max =nums[x]
print(max)
ํ์ด์ฌ์ ์ฝ๋๊ฐ ํจ์ฌ ๊ฐ๊ฒฐํ๊ธด ํ๋ฐ... ์ ๋ง ์์ ์ซ์ซ ์ ๋ฌ๋ผ๋ถ๋๋ค ใ ใ
728x90
'Java & Spring > Java Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[์๋ฐ/ํ์ด์ฌ ์๊ณ ๋ฆฌ์ฆ] ์ ํ ์ ๋ ฌ ์๊ณ ๋ฆฌ์ฆ (0) | 2022.12.19 |
---|---|
[์๋ฐ/ํ์ด์ฌ ์๊ณ ๋ฆฌ์ฆ] ์์ ์๊ณ ๋ฆฌ์ฆ (0) | 2022.12.19 |
[์๋ฐ/ํ์ด์ฌ ์๊ณ ๋ฆฌ์ฆ] ๊ทผ์ฟ๊ฐ ์๊ณ ๋ฆฌ์ฆ (0) | 2022.12.17 |
[์๋ฐ/ํ์ด์ฌ ์๊ณ ๋ฆฌ์ฆ] ํฉ๊ณ ์๊ณ ๋ฆฌ์ฆ (1) | 2022.12.17 |
[์๋ฐ/ํ์ด์ฌ ์๊ณ ๋ฆฌ์ฆ] ํ์ต ์์ (0) | 2022.12.17 |