
面试题
文章平均质量分 81
tiefanhe
这个作者很懒,什么都没留下…
展开
-
跨平台系统栈的增长方向判断
对于一个用惯了i386系列的机器,跨硬件平台是这个问题的首先要考虑到的因素。C是一个不错的选择。那接下来的问题就是如何用C在哪里会用到栈呢?稍微了解一点等一下,怎么比较两个变量的地址呢?“先声明的先入栈那就函数加个参数,比较参数和局部变量的位置,参数肯定先入栈。那为什么不能局部变量先入栈?第一反应是怎么可能,但仔细想来又没有什么不可以。所以,这种方法也依赖于编译器的实现。不妨回想一转载 2014-09-13 10:24:31 · 565 阅读 · 0 评论 -
808. Soup Servings
There are two types of soup: type A and type B. Initially we have N ml of each type of soup. There are four kinds of operations:Serve 100 ml of soup A and 0 ml of soup BServe 75 ml of soup A and 25 ml...原创 2018-05-02 13:44:57 · 369 阅读 · 0 评论 -
807. Max Increase to Keep City Skyline
In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amounts can...原创 2018-05-02 12:42:36 · 382 阅读 · 0 评论 -
806. Number of Lines To Write String
We are to write the letters of a given string S, from left to right into lines. Each line has maximum width 100 units, and if writing a letter would cause the width of the line to exceed 100 units, it...原创 2018-05-01 13:51:17 · 176 阅读 · 0 评论 -
805. Split Array With Same Average
In a given integer array A, we must move every element of A to either list B or list C. (B and C initially start empty.)Return true if and only if after such a move, it is possible that the average va...原创 2018-05-01 13:14:31 · 351 阅读 · 0 评论 -
[leetcode 804] Unique Morse Code Words
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on.For原创 2018-04-16 12:39:26 · 202 阅读 · 0 评论 -
[leetcode 803] Bricks Falling When Hit
We have a grid of 1s and 0s; the 1s in a cell represent bricks. A brick will not drop if and only if it is directly connected to the top of the grid, or at least one of its (4-way) adjacent bricks wi...原创 2018-04-16 10:38:24 · 887 阅读 · 0 评论 -
[leetcode 802] Find Eventual Safe States
In a directed graph, we start at some node and every turn, walk along a directed edge of the graph. If we reach a node that is terminal (that is, it has no outgoing directed edges), we stop.Now, say ...原创 2018-04-16 09:24:17 · 649 阅读 · 0 评论 -
[leetcode 801] Minimum Swaps To Make Sequences Increasing
801. Minimum Swaps To Make Sequences IncreasingWe have two integer sequences A and B of the same non-zero length.We are allowed to swap elements A[i] and B[i]. Note that both elements are in the same...原创 2018-04-16 08:14:18 · 391 阅读 · 0 评论 -
Leetcode[3] Longest Substring Without Repeating Characters
Given astring, find the length of the longest substring without repeating characters.For example, the longest substring without repeating letters for"abcabcbb" is "abc", which the length is 3. For"bbb原创 2015-05-07 21:41:59 · 424 阅读 · 0 评论 -
Leetcode[4] Median of Two Sorted Arrays
There are two sorted arraysA and B of size m and n respectively. Find the median of the two sorted arrays.The overall run time complexity should be O(log (m+n)).C++版本double findMedianSortedArr原创 2015-05-07 22:30:13 · 392 阅读 · 0 评论 -
Leetcode[1] Two Sum
Givenan array of integers, find two numbers such that they add up to a specifictarget numberThefunction twoSum should return indices of the two numbers such that they addup to the target, whereind原创 2015-04-28 17:17:20 · 356 阅读 · 0 评论 -
Leetcode[2] Add Two Numbers
You are given two linkedlists representing two non-negative numbers. The digits are stored in reverseorder and each of their nodes contain a single digit. Add the two numbers andreturn it as a linke原创 2015-04-29 11:30:46 · 334 阅读 · 0 评论 -
809. Expressive Words
Sometimes people repeat letters to represent extra feeling, such as "hello" -> "heeellooo", "hi" -> "hiiii". Here, we have groups, of adjacent letters that are all the same character, and adjac...原创 2018-05-02 14:24:57 · 549 阅读 · 0 评论