随笔分类 -  Daily Coding Problem

1
摘要:Given an array of words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justif 阅读全文
posted @ 2020-07-25 00:00 Review->Improve 阅读(791) 评论(0) 推荐(0)
摘要:Given a linear equation of n variables, find the total number of non-negative integer solutions of it. All coefficients are positive. Example: input: 阅读全文
posted @ 2019-12-04 23:58 Review->Improve 阅读(240) 评论(0) 推荐(0)
摘要:You are given a series of arithmetic equations as a string, such as: y = x + 1 5 = x + 3 10 = z + y + 2 The equations use addition only and are separa 阅读全文
posted @ 2019-12-04 12:19 Review->Improve 阅读(336) 评论(0) 推荐(0)
摘要:A quack is a data structure combining properties of both stacks and queues. It can be viewed as a list of elements written left to right such that thr 阅读全文
posted @ 2019-11-29 01:43 Review->Improve 阅读(3294) 评论(0) 推荐(0)
摘要:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to count the total strobog 阅读全文
posted @ 2019-11-24 02:41 Review->Improve 阅读(270) 评论(0) 推荐(0)
摘要:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Find all strobogrammatic numbers that are o 阅读全文
posted @ 2019-11-24 02:38 Review->Improve 阅读(233) 评论(0) 推荐(0)
摘要:You are given a string consisting of the letters x and y, such as xyxxxyxyy. In addition, you have an operation called flip, which changes a single x  阅读全文
posted @ 2019-10-25 00:48 Review->Improve 阅读(1298) 评论(0) 推荐(0)
摘要:You have N stones in a row, and would like to create from them a pyramid. This pyramid should be constructed such that the height of each stone increa 阅读全文
posted @ 2019-09-20 05:46 Review->Improve 阅读(448) 评论(0) 推荐(0)
摘要:A competitive runner would like to create a route that starts and ends at his house, with the condition that the route goes entirely uphill at first, 阅读全文
posted @ 2019-09-19 11:38 Review->Improve 阅读(1201) 评论(0) 推荐(1)
摘要:On a mysterious island there are creatures known as Quxes which come in three colors: red, green, and blue. One power of the Qux is that if two of the 阅读全文
posted @ 2019-09-14 03:21 Review->Improve 阅读(1927) 评论(0) 推荐(0)
摘要:A cryptarithmetic puzzle is a mathematical game where the digits of some numbers are represented by letters. Each letter represents a unique digit. Fo 阅读全文
posted @ 2019-08-06 10:17 Review->Improve 阅读(1498) 评论(0) 推荐(0)
摘要:Typically, an implementation of in-order traversal of a binary tree has O(h) space complexity, where h is the height of the tree. Write a program to c 阅读全文
posted @ 2019-07-10 22:40 Review->Improve 阅读(732) 评论(0) 推荐(0)
摘要:Given a sorted array of non-negative integers, find the smallest positive integer that is not the sum of a subset of the array. For example, for the i 阅读全文
posted @ 2019-07-10 11:43 Review->Improve 阅读(432) 评论(0) 推荐(0)
摘要:This problem was asked by Google. In a directed graph, each node is assigned an uppercase letter. We define a path's value as the number of most frequ 阅读全文
posted @ 2019-02-12 13:00 Review->Improve 阅读(3892) 评论(0) 推荐(0)
摘要:This problem was asked by Microsoft. A number is considered perfect if its digits sum up to exactly 10. Given a positive integer n, return the n-th pe 阅读全文
posted @ 2019-02-06 01:14 Review->Improve 阅读(213) 评论(0) 推荐(0)
摘要:This problem was asked by Google. On our special chessboard, two bishops attack each other if they share the same diagonal. This includes bishops that 阅读全文
posted @ 2019-02-05 02:51 Review->Improve 阅读(1946) 评论(0) 推荐(0)
摘要:This problem was recently asked by Google. Given a list of numbers and a number k, return whether any two numbers from the list add up to k. For examp 阅读全文
posted @ 2018-12-22 06:20 Review->Improve 阅读(319) 评论(0) 推荐(0)
摘要:Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k num 阅读全文
posted @ 2018-12-22 06:01 Review->Improve 阅读(307) 评论(0) 推荐(0)
摘要:This problem was asked by Google. Implement locking in a binary tree. A binary tree node can be locked or unlocked only if all of its descendants or a 阅读全文
posted @ 2018-12-22 02:35 Review->Improve 阅读(3065) 评论(0) 推荐(0)
摘要:This problem was asked by Twitter. You run an e-commerce website and want to record the last N order ids in a log. Implement a data structure to accom 阅读全文
posted @ 2018-12-14 01:45 Review->Improve 阅读(1828) 评论(0) 推荐(0)

1