분류 전체보기 207

알고리즘 꿀팁. 자바

1. 디버깅 시 문구와 변수 같이 출력하고 싶을때 System.out.printf("비교문 출력 %d < %d || %d < %d",a,b,c,d); System.out.printf("문자열 출력 %s",e); 2. 최소값, 최대값 구할때 int min = Integer.MAX_VALUE; while (true) { ... min = Math.min(min, origin[currentX][currentY]); ... } return min; 3. 배열 출력할 때 import java.util.Arrays; // 1차원 배열 System.out.println(Arrays.toString(arr)); // 2차원 배열 System.out.println(Arrays.deepToString(arr)); 4. h..

laravel. validator 문서 및 커스터마이징

공식문서 : Laravel - The PHP Framework For Web Artisans Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things. laravel.com 1. 에러 메시지에 :input, :attribute, :min, :max 사용해서 메시지 커스터마이징 가능함 'between' => 'The :attribute value :input is not between :min - :max.' Laravel Array Validation Message..

개발/라라벨 2022.06.27

programmers. 행렬 테두리 회전하기

https://programmers.co.kr/learn/courses/30/lessons/77485?language=java# 코딩테스트 연습 - 행렬 테두리 회전하기 6 6 [[2,2,5,4],[3,3,6,6],[5,1,6,3]] [8, 10, 25] 3 3 [[1,1,2,2],[1,2,2,3],[2,1,3,2],[2,2,3,3]] [1, 1, 5, 3] programmers.co.kr 내가 생각한 알고리즘 내 풀이 (2H) import java.util.Arrays; class Solution { int[] dx = {0, 1, 0, -1}; int[] dy = {1, 0, -1, 0}; int[][] origin; int[][] copy; public int[] solution(int rows, ..

programmers. 로또의 최고 순위와 최저 순위

문제 링크 코딩테스트 연습 - 로또의 최고 순위와 최저 순위 로또 6/45(이하 '로또'로 표기)는 1부터 45까지의 숫자 중 6개를 찍어서 맞히는 대표적인 복권입니다. 아래는 로또의 순위를 정하는 방식입니다. 1 순위 당첨 내용 1 6개 번호가 모두 일치 2 5개 번호 programmers.co.kr 내가 쓴 풀이 # 로또 번호 당첨 체크하는 함수 def isWin(win_nums, lotto): for num in win_nums: if (num == lotto): return True return False # 랭크 계산해주는 함수 def getRankByWin(win): if (win < 2): # 0,1개는 모두 6위 (tc 포함해야 하는 케이스) return 6; else: return 7 -..

laravel. array 에 추가 하는 방법

$cart = array(); $cart[] = 11; $cart[] = 15; $cart = array(); array_push($cart, 13); array_push($cart, 14); 인텔리제이에서는 하나의 element일때는 array_push 방법을 권장하지 않는다. How to add elements to an empty array in PHP? If I define an array in PHP such as (I don't define its size): $cart = array(); Do I simply add elements to it using the following? $cart[] = 13; $cart[] = "foo"; $cart[] = obj; Don't arrays in....

개발/라라벨 2022.06.21
반응형