Giter Club home page Giter Club logo

guohui.Deng's Projects

binarygap icon binarygap

A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contains two binary gaps: one of length 4 and one of length 3. The number 20 has binary representation 10100 and contains one binary gap of length 1. The number 15 has binary representation 1111 and has no binary gaps. Write a function: class Solution { public int solution(int N); } that, given a positive integer N, returns the length of its longest binary gap. The function should return 0 if N doesn't contain a binary gap. For example, given N = 1041 the function should return 5, because N has binary representation 10000010001 and so its longest binary gap is of length 5. Assume that: N is an integer within the range [1..2,147,483,647]. Complexity: expected worst-case time complexity is O(log(N)); expected worst-case space complexity is O(1).

paddleclas icon paddleclas

A treasure chest for image classification powered by PaddlePaddle

queueforpaypay icon queueforpaypay

Implement Queue, which should be immutable, generic class, and function as a queue.

scoresummary icon scoresummary

以下の4メソッドを持つExamSummaryクラスを作成せよ。 /** * 学籍番号,科目,得点を登録する */ void register(String 学籍番号 , Subject 科目 , int 得点); /** * 引数で指定された学籍番号・科目の得点を返す * @return 得点 */ int getScore(String 学籍番号, Subject 科目); /** * 引数で指定された科目の最高得点の学籍番号を返す * @return 学籍番号のリスト */ List<String> getTopScoreIdsBySubject(Subject 科目); /** * 全科目の平均得点の高い順に学籍番号を返す * @return 学籍番号のリスト */ List<String> getIdsByAverage(); なおSubjectは以下のような定義でよい。 enum Subject { MATH, SCIENCE, ENGLISH } 使用例) ExamSummary es = new ExamSummary(); es.register ("00kc001",Subject.MATH , 85); es.register ("00kc001",Subject.SCIENCE , 75); es.register ("00kc001",Subject.ENGLISH , 65); es.register ("00kc002",Subject.MATH , 60); es.register ("00kc002",Subject.SCIENCE , 80); es.register ("00kc002",Subject.ENGLISH , 70); es.register ("00kc003",Subject.MATH , 90); es.register ("00kc003",Subject.SCIENCE , 55); es.register ("00kc003",Subject.ENGLISH , 65); int score = es.getScore("00kc002",Subject.MATH); List<String> topScoreIds = es.getTopScoreIdsBySubject(Subject.ENGLISH); List<String> ids = es.getIdsByAverage();

splitter icon splitter

A thread-safe Splitter class, which can split char, string, regex expression, fixed length

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.