Giter Club home page Giter Club logo

coding-interviews's Introduction

Coding-Interviews

给出前序遍历和中序遍历,构建二叉树。 递归的方式求出左右子树的节点。

很明显的中序遍历,主要是找出相邻递归间的关联,在写递归的时候,能递归的不要去想,仅仅recursive(node.left)就行,只想着当前层就行, 然后再考虑边界条件,即最左边和最右边。 相邻递归的连接就是,节点要知道左子树的最大值,因此在recursive()之后,需要一个变量能够指向左子树的最大值,然后把节点当成右子树的左侧最大值, 这个很难想到。

动态规划,找出n个骰子和之前几个的依赖关系,然后用一个数组n*6+1来存储n个骰子的和,总和为n的跟n-1,。。。 n-6有关,n-i有范围。

coding-interviews's People

Contributors

yahiko-r avatar

Watchers

 avatar

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.