본문 바로가기

전체 글24

[리트코드] 49. Group Anagrams (HashTable) 문제 정보 Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. Example 1: Input: strs = ["eat","tea","tan","ate","nat","bat"] Output: [["bat"],["nat","tan"],["ate","eat","tea"]] Example 2: Input: strs = .. 2022. 1. 26.
[리트코드] 2011. Final Value of Variable After Performing Operations (string) 문제 정보 There is a programming language with only four operations and one variable X: ++X and X++ increments the value of the variable X by 1. --X and X-- decrements the value of the variable X by 1. Initially, the value of X is 0. Given an array of strings operations containing a list of operations, return the final value of X after performing all the operations. 문제 풀이 string 배열에서 string을 하나하나씩 꺼.. 2022. 1. 26.
[리트코드] 1. TwoSum (array) 문제 정보 Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. 문제 풀이 exactly one solution이므로 목표값에서 해당 element를 뺀 나머지 값이 배열에서 존재하는지 찾으면 된다. 동일한 값을 중복으로 더하면 안되므로, 관련 조건을 추가해준다. writeup pu.. 2022. 1. 26.
[리트코드] 53. Maximum Subarray (DP, Kadane's algorithm) 문제 정보 Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. A subarray is a contiguous part of an array. 문제 풀이 단순하게 모든 부분합을 반복하며 최대값을 구해 저장할 수 도 있겠지만 이는 O(n^2) 시간복잡도를 가진다. DP나 카데인 알고리즘을 사용하여 풀이하면 O(n)으로 해결할 수 있다. Kadane's algorithm 이란? The simple idea of Kadane’s algorithm is to look for all positive contiguous se.. 2022. 1. 25.
Prefabs Instantiation을 주로 사용하는 3가지 경우 유니티 메뉴얼을 읽다 Prefabs Instantiation을 사용하는 경우가 주로 다음 세 가지 형태로 나타난다고 안내해주고 있는 부분이 있어 내용을 정리해 보았다. Building a structure out of a single Prefab by replicating it multiple times in different positions, for example in a grid or circle formation. Firing a projectile Prefab from a launcher. The projectile Prefab could be a complex configuration containing A vehicle, building or character, for example a ro.. 2022. 1. 20.
[Rookiss 강좌] 4. Resource Manager 본 내용은 'Rookiss님의 C#과 유니티로 만드는 MMORPG 게임 개발 시리즈 강좌'를 참고하여 작성되었습니다. Resource Manager 객체란? 프리팹을 gameobject로 변환시켜주는 Manager이다. 유니티 프로그램에서는 드래그앤 드롭으로 만들 수 있지만 이를 Resource Manager를 통해 스크립트화해서 자동으로 생성할 수 있다. Simple PrefabTest(1) 간단한 코드부터 작성해보자. 스크립트 상에서 프리팹은 Instantiate() 메서드를 통해 오브젝트화(GameObject) 될 수 있다. 우선 프리팹을 PrefabTest 스크립트에 드래그앤 드롭으로 삽입시키고 다음과 같이 스크립트를 작성하면 오브젝트가 생성된다. 그리고 Destory()를 이용해서 오브젝트를 삭.. 2022. 1. 18.