3 李歇特冯·兹拜因巴哈
尚未进行身份认证
NULL
Given the radius and x-y positions of the center of a circle, write a functionrandPointwhichgenerates a uniform randompoint in the circle.Note:input and output values areinfloating-point. r...
TheHamming distancebetween two integers is the number of positions at which the corresponding bits are different.Now your job is to find the total Hamming distance between all pairs of the given n...
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given integer is guaranteed to fit within the range of a 3...
Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses.Now, you are given positions of houses and heaters on a horizontal li...
In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue.For now, suppose you are a dominator ofm0sandn1srespectively. On the other ...
Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match girl has, please find out a way you can make one square by using up all those matchsticks. You shoul...
。。。
Given a list of words (without duplicates), please write a program that returns all concatenated words in the given list of words.A concatenated word is defined as a string that is comprised entirel...
。。。
Given a functionrand7which generates a uniform random integer in the range 1 to 7, write a functionrand10which generates a uniform random integer in the range 1 to 10.Do NOT use system'sMath.ra...
Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither.IPv4addresses are canonically represented in dot-decimal notation, which consists of four decima...
Consider the stringsto be the infinite wraparound string of "abcdefghijklmnopqrstuvwxyz", soswill look like this: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....".Now we have a...
DefineS = [s,n]as the string S which consists of n connected strings s. For example,["abc", 3]="abcabcabc".On the other hand, we define that string s1 can be obtained from string s2 if we can re...
...
In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach or exceed 100 wins.What if we change the game so ...
You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water.Grid cells are connected horizontally/vertically (not diagonally). The grid is completely...
Given anon-emptyinteger array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected element by ...
TheHamming distancebetween two integers is the number of positions at which the corresponding bits are different.Given two integersxandy, calculate the Hamming distance.Note:0 ≤x,y< 23...
Design and implement a data structure forLeast Frequently Used (LFU)cache. It should support the following operations:getandput.get(key)- Get the value (will always be positive) of the key if ...
Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase Engli...