Giter Club home page Giter Club logo

fba_quant's Introduction

Hi there πŸ‘‹

Giung's GitHub stats

Top Langs

GitHub Streak

overview

languages

fba_quant's People

Contributors

inandout-kr avatar

Watchers

 avatar

fba_quant's Issues

Longest Substring Without Repeating Characters

class Solution(object):
    def lengthOfLongestSubstring(self, s):
        dic, res, start, = {}, 0, 0        
        for i, ch in enumerate(s):  # enumerate ν•¨μˆ˜λ₯Ό μ΄μš©ν•΄ 각 값에 인덱슀λ₯Ό λΆ€μ—¬ν•΄μ€€λ‹€.
            if ch in dic:                    # ν˜„μž¬ forλ¬Έμ—μ„œ νŒμ •λ˜κ³  μžˆλŠ” λ¬Έμžμ™€ λ™μΌν•œ λ¬Έμžκ°€ λ”•μ…”λ„ˆλ¦¬μ— μžˆμ„ 경우 
                res = max(res, i-start)   # λ”•μ…”λ„ˆλ¦¬ λ‚΄ ν˜„μž¬κΉŒμ§€ 문자 μš”μ†Œκ°€ λ°˜λ³΅λ˜μ§€ μ•Šμ€ λ¬Έμžμ—΄μ˜ μ΅œλŒ€ 길이
                start = max(start, dic[ch]+1)   # λ‹€μŒ μˆœμ„œλ‘œ νŒμ •ν•  문자의 인덱슀
            dic[ch] = i                                        # λ”•μ…”λ„ˆλ¦¬μ— λ¬Έμžμ™€ 인덱슀 μΆ”κ°€
        return max(res, len(s)-start)            # λ™μΌν•œ λ¬Έμžκ°€ μ€‘λ³΅λ˜μ§€ μ•Šμ€ λ¬Έμžμ—΄ 쀑 κ°€μž₯ κΈ΄ λ¬Έμžμ—΄μ˜ 길이 리턴

Increasing Triplet Subsequence

class Solution:
    def increasingTriplet(self, nums):
        
        first = float("inf")
        second = float("inf")
        
        for i in range(len(nums)):
            if nums[i] < first:
                first = nums[i]
            elif first < nums[i] < second:
                second = nums[i]
            if nums[i] > second:
                return True
        return False

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.