Giter VIP home page Giter VIP logo

leetcoderecord's Introduction

LeetCodeRecord

Collection of LeetCode questions to ace the coding interview! - Created using LeetHub


오답노트

  • 처음에 3차원 DP 배열을 사용했는데, 메모리 초과가 발생했다. 크기가 크다보니 미리 예상하긴 했지만 다른 방법이 생각나지 않아서 결국 제출했던건데 역시는 역시나였다..

    dp[startIdx][endIdx][i]
    

    다시 곰곰히 생각해보니 nums[]의 끝이나 앞에서만 숫자를 제거할 수 있고, i 값으로 그동안 몇개의 숫자가 제거되었는지 알 수 있다.

    따라서 다음의 식이 성립한다는걸 깨달았고, startIdx만 저장해서 푸는 식으로 해결을 했다.

    endIdx = (nums.length - 1) - (i - startIdx)
    
  • 그리고 nums[]에 숫자가 하나만 있을 경우, 값을 바로 리턴할 수 있도록 로직을 작성했는데 nums[startIdx] * mulipliers[i]가 아닌 nums[startIdx]만 리턴해주도록 구현 실수를 해서 한번 틀렸다.

    아마 오답 테스트케이스를 볼 수 없었다면 해결하는데 시간이 꽤 걸렸을 것 같다.


leetcoderecord's People

Contributors

chisanahn avatar

Watchers

 avatar

leetcoderecord's Issues

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.