saurus2
Saurus2
saurus2
전체 방문자
오늘
어제
  • 분류 전체보기
    • 개발
      • AJAX
    • ML Ops
    • Profile
    • 음식점
    • 배낭여행
    • 컴퓨터공학
      • 알고리즘 공부
      • C++
      • Sever 스터디
      • Java spring
      • 알고리즘 _ 문제해결
      • 딥러닝
      • Java 정리
      • Python
      • LeetCode 1000
      • Machine Learning Study
      • Sign language Detection Pro..
      • LeetCode Solutions
    • 비콘
    • 데일리 리포트
    • 유학일기
      • 영어 공부
      • Daily
    • AI Master Degree
      • Data Mining
      • AI and Data engineering
      • Math Foundations for Decisi..
      • Natural Language Processing

블로그 메뉴

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록

공지사항

인기 글

태그

  • BFS
  • 알고리즘문제해결
  • 개발자
  • 딥러닝
  • 알고리즘
  • 취준
  • Python
  • 문제해결능력
  • DFS
  • c++
  • 딕셔너리
  • two pointer
  • 백준
  • 릿코드
  • LeetCode
  • 파이썬
  • 개발자 취업준비
  • 리트코드
  • 취업준비
  • 온라인저지

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
saurus2

Saurus2

컴퓨터공학/LeetCode Solutions

LeetCode 121 Best Time To Buy And Sell Stock 주식을 사고 팔기 가장 좋은시간

2023. 10. 14. 07:35

안녕하세요 코딩세끼 입니다.
개발자가 되고 싶은 구독자들을 위해 코딩 스터디 영상을 제작하고 있습니다.
미국 실리콘 밸리 뿐만아니라 한국에서도 개발자 능력의 필수 요소로 코딩테스트 및 코딩 인터뷰가 요구 되고 있습니다. 영상 구성은 다음과 같습니다.

-영상 구성-
스터디 영상 하나에 리트코드 문제 하나를 각자 풀 수 있도록 영상을 구성하였습니다. 
스터디를 진행해보시면서 궁금한 점이나 피드백이 있으면 댓글 부탁드립니다. 

이번 영상은 릿코드(리트코드) 121번 문제 Best Time To Buy And Sell Stock 1 문제를 다루는 스터디입니다.
LeetCode No 121 Best Time To Buy And Sell Stock 1

-스터디 방식-
1. 동영상을 재생하는 동안 각자 문제를 풀 시간 20분이 주어집니다.
2. 5분마다 힌트를 드립니다.
2-1) 문제 번역
2-2) 문제 접근 방법
2-3) 문제 풀이 힌트
3. 20분이 지나면 문제 풀이를 진행 합니다.
3-1) 한 문제에서 나오는 모든 풀이들을 다루려고 노력하고 있습니다.

현재는 Python으로 해설을 진행하며, 추후 요청에따라 다른 언어로도 영상을 찍도록 하겠습니다.

https://youtu.be/QTf2P4rcNgw

https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/

 

Best Time to Buy and Sell Stock - LeetCode

Can you solve this real interview question? Best Time to Buy and Sell Stock - You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosin

leetcode.com

You are given an array prices where prices[i] is the price of a given stock on the ith day.

You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.

Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.

 

Example 1:

Input: prices = [7,1,5,3,6,4]
Output: 5
Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5.
Note that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.

Example 2:

Input: prices = [7,6,4,3,1]
Output: 0
Explanation: In this case, no transactions are done and the max profit = 0.

 

Constraints:

  • 1 <= prices.length <= 105
  • 0 <= prices[i] <= 104
저작자표시 (새창열림)

'컴퓨터공학 > LeetCode Solutions' 카테고리의 다른 글

LeetCode 704 Binary search 이진 탐색  (0) 2023.10.14
LeetCode 242 valid Anagram 유효한 아나그램  (0) 2023.10.14
LeetCode 21 Merge Two Sorted Lists 릿코드 두개의 정렬된 리스트 병합하기  (0) 2023.10.14
Leetcode 20 Valid Parentheses 릿코드 20번 Valid Parentheses  (0) 2023.10.14
LeetCode 217 Contains Duplicate 릿코드 중복 포함  (0) 2023.10.14
    '컴퓨터공학/LeetCode Solutions' 카테고리의 다른 글
    • LeetCode 704 Binary search 이진 탐색
    • LeetCode 242 valid Anagram 유효한 아나그램
    • LeetCode 21 Merge Two Sorted Lists 릿코드 두개의 정렬된 리스트 병합하기
    • Leetcode 20 Valid Parentheses 릿코드 20번 Valid Parentheses
    saurus2
    saurus2
    Simple is Best

    티스토리툴바