Giter Site home page Giter Site logo

one-day-one-puzzle's Introduction

one-day-one-puzzle

one-day-one-puzzle

see issue

one-day-one-puzzle's People

Contributors

maoxiaoke avatar

Watchers

James Cloos avatar  avatar  avatar

one-day-one-puzzle's Issues

5. 第一个非重复字母

题干描述:

Write a function named first_non_repeating_letter that takes a string input, and returns the first character that is not repeated anywhere in the string.

For example, if given the input 'stress', the function should return 't', since the letter t only occurs once in the string, and occurs first in the string.

As an added challenge, upper- and lowercase letters are considered the same character, but the function should return the correct case for the initial letter. For example, the input 'sTreSS' should return 'T'.

If a string contains all repeating characters, it should return an empty string ("") or None

1. new 跟 object.create 有什么区别?

Friend: new 是先新建一个 Object 对象,再用这个对象去继承目标对象的 prototype。 Object.create() 是先新建一个隐式构造函数,用它的 prototype 去继承目标对象,最后 new 一个对象

10. 数字回文

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Could you solve it without converting the integer to a string?

9. 多数组排列组合

描述:有一家奶茶店生产 ['奶茶', '咖啡','果汁'] 三个品类,有 ['大',‘中’,’小‘] 三个尺寸,有 ['8分甜',‘5分甜’,’不甜‘] 三个糖度

列举出所有的品类,比如 5分甜的小杯奶茶

6. 阶乘的末尾有多少个 0

题干描述:

Write a program that will calculate the number of trailing zeros in a factorial of a given number.

N! = 1 * 2 * 3 * ... * N

Examples zeros(6) = 1

# 6! = 1 * 2 * 3 * 4 * 5 * 6 = 720 --> 1 trailing zero

zeros(12) = 2

# 12! = 479001600 --> 2 trailing zeros

11. 浏览器事件有哪些过程? 为什么一般在冒泡阶段,而不是在捕获阶段注册监听?

事件流描述的是从页面中接收事件的顺序。

“DOM2级事件”规定的事件流包括三个阶段: 事件捕获阶段、处于目标阶段和事件冒泡阶段。从最不具体的元素(document) 捕获到最具体的元素,再从最具体的元素冒泡到最不具体的元素。最后在冒泡阶段对事件进行相应。

为事件代理(委托)提供条件,即事件代理依赖事件冒泡。

  1. 取消事件冒泡 event.stopPropagation()
  2. 取消默认行为 event.preventDefault()
  3. 事件代理的原理:event 有个 targe 属性,永远指向最具体的元素

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.