목록순열 (2)
어흥
문제 링크: https://leetcode.com/problems/next-permutation/description/ Next Permutation - LeetCode Can you solve this real interview question? Next Permutation - A permutation of an array of integers is an arrangement of its members into a sequence or linear order. * For example, for arr = [1,2,3], the following are all the permutations of arr: [1,2,3], leetcode.com 1. 순열의 순서는 어떻게 정해질까?에 대한 의문을 직접 구..
문제 링크: https://www.acmicpc.net/problem/1342 1342번: 행운의 문자열 민식이와 준영이는 자기 방에서 문자열을 공부하고 있다. 민식이가 말하길 인접해 있는 모든 문자가 같지 않은 문자열을 행운의 문자열이라고 한다고 한다. 준영이는 문자열 S를 분석하기 시작� www.acmicpc.net 1. 주의할 점 - 문자열을 V벡터에 입력받고, Next_Permutation을 하기 전에 Sort를 수행한다 2. 구현 - Next_Permutation을 수행하기 전에 반드시 Sort를 수행한다. 입력받는 문자열이 순서대로 들어오지 않기 때문이다(이해가 되지 않는다면 1234와 4321을 출력해보면 안다. 이때의 정답은 24가 올바르다) - Next_Permutation을 수행하면서 ..