본문 바로가기

DART14

[Algorithm] Dart로 풀어보는 Summary Ranges 요약 범위 You are given a sorted unique integer array nums.A range [a,b] is the set of all integers from a to b (inclusive).Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, each element of nums is covered by exactly one of the ranges, and there is no integer x such that x is in one of the ranges but not in nums.Each range [a,b] in the list should be outpu.. 2025. 8. 4.
[Algorithm] Dart로 풀어보는 주식 매수&매도 최적 시기 You are given an integer array prices where prices[i] is the price of a given stock on the ith day.On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any time. However, you can buy it then immediately sell it on the same day.Find and return the maximum profit you can achieve.Example 1:Input: prices = [7,1,5,3,6,4]Output: 7Explanation: Bu.. 2025. 7. 31.
[Dart] List 와 Queue 의 차이 (강의자료) ListList 는 순서가 있는 데이터 컬렉션 입니다. 그리고 인덱스를 사용해 요소에 접근해서 데이터를 사용할 수 있습니다. Dart 에서의 리스트는 크기에 제한을 두거나 혹은 제한을 두지 않는 형태로도 만들 수 있습니다. 기본적으로 List 를 생성하는 방법은 크기에 제한을 두지 않습니다.var fruits = ['apple', 'banana'];List = [1, 2, 3, 4, 5]; 위와 같은 형태로 List 를 만들게되면 요소를 추가하거나 삭제하는 등 자유롭게 할 수 있습니다. 이완 다르게 List 의 개수를 제한하게 할 수 있는 방법은 다음과 같습니다.var list = List.filled(5, 0, growable: false);var list = List.generate(5, (i) =>.. 2025. 7. 29.
[강의자료] Json 무엇이고 Dart 에서 어떻게 사용할까? JSONJSON(JavaScript Object Notation) 은 데이터를 구조화해서 저장하고 전달히기 위한 텍스트 기반의 데이터 포맷입니다. 즉, 데이터를 구조화해서 특정 형태의 형식으로 전달합니다.사람이 읽고 쓰기 쉽고, 구조화의 예는 다음과 같습니다.{ "name": "HealthyRyu", "age": 30, "isAlive": true} 구조화를 했다는것은 정보가 어떤 의미를 가지는지 명확하게 정해져있고, key-value 형태로 정리되어 있는것을 의미합니다. 특징- 경략 텍스트 포맷- 다양한 언어에서 지원 (Dart, Kotlin, JavaScript, Python 등)- 데이터 구조가 key-value 형태로 표현- String, int, double, boolean, Null, .. 2025. 7. 25.
Dart 에서 Collection Map 을 알아보자 Map은 키와 값을 한쌍으로 저장하는 컬렉션 입니다.MapMapMap 특징키 값은 중복이 없어야 함키 하나에 값 하나만 연결(매핑)키(key) 타입과 값(value) 타입은 같게 혹은 다르게 설정이 가능 기본적인 Map 생성 방법은 다음과 같습니다.var mapDefault = {};var mapDynamic = {}; // Map 으로 추론됨// 명시적으로 타입을 선언한 형태var mapDefault = { "apple" : 1, "banana" : 2};// 암묵적으로 타입을 선언하지 않은 형태var mapDynamic = {"apple" : 1, "banana" : 2}; Map for 문 사용한 탐색 방법기본 MapMap scores = {'Alice': 90, 'Bob': 85, 'Charl.. 2025. 6. 25.
[Flutter] Dart, Flutter 설치 오류 Flutter 설치를 후, Flutter 프로젝트가 생성이 되지 않고 다음과 같은 에러가 났습니다. [!] Flutter (Channel stable, 3.29.2, on macOS 14.6 23G80 darwin-arm64, locale ko-KR) ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.7.1/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/choiseewoong/development/flutter. Consider adding /Users/.../development/flutter/bin to the .. 2025. 3. 19.