- 博客(256)
- 资源 (14)
- 收藏
- 关注
原创 类与类之间的关系之UML类图识别
关联关系关联关系(Association)是类与类之间最常用的一种关系,它是一种结构化关系,用于表示一类对象与另一类对象之间有联系。 在UML类图中,用实线连接有关联的对象所对应的类,在使用Java、C#和C++等编程语言实现关联关系时,通常将一个类的对象作为另一个类的属性。 在使用类图表示关联关系时可以在关联线上标注角色名。
2014-04-26 16:24:55 2560
原创 Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
2015-09-16 08:20:59 355
原创 Text Justification
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You should pack your words in a greedy approach; that is,
2015-09-16 08:20:35 392
原创 Divide Two Integers
Divide two integers without using multiplication, division and mod operator.
2015-09-16 08:20:03 337
原创 ZigZag Conversion
The string ”PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y
2015-09-16 08:19:41 268
原创 Spiral Matrix II
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should return the following matrix: [ [ 1, 2, 3 ], [ 8, 9, 4 ], [ 7,
2015-09-16 08:19:14 397
原创 Spiral Matrix
Given a matrix of m×n elements (m rows, n columns), return all elements of the matrix in spiral order. For example, Given the following matrix: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] You shou
2015-09-16 08:18:41 263
原创 Pascal’s Triangle II
Given an index k, return the kth row of the Pascal’s triangle. For example, given k = 3, Return [1,3,3,1]. Note: Could you optimize your algorithm to use only O(k) extra space?
2015-09-16 08:17:58 249
原创 Pascal’s Triangle
Given numRows, generate the first numRows of Pascal’s triangle. For example, given numRows = 5, Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1] ]
2015-09-15 09:25:50 246
原创 Substring with Concatenation of All Words
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without an
2015-09-15 09:25:28 226
原创 Multiply Strings
Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-negative.
2015-09-15 09:25:05 234
原创 Minimum Window Substring
Given a string S and a string T , find the minimum window in S which will contain all the characters in T in complexity O(n). For example, S = ”ADOBECODEBANC”, T = ”ABC” Minimum window is ”BANC”. N
2015-09-15 09:24:43 227
原创 Merge Intervals
Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,10],[15,18], return [1,6],[8,10],[15,18]
2015-09-15 09:24:20 248
原创 Insert Interval
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times. Exampl
2015-09-15 09:23:56 279
原创 Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negative integers be palindromes? (ie, -1) If you are thinking of converting the integer to string, note
2015-09-15 09:23:38 263
原创 Reverse Integer
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have you thought about this? Here are some good questions to ask before coding. Bonus points for you if y
2015-09-15 09:23:16 229
原创 Clone Graph
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbours. OJ’s undirected graph serialization: Nodes are labeled uniquely. We use # as a separator for each node
2015-09-15 09:22:54 298
原创 Word Break II
Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences. For example, given s = “cats
2015-09-15 09:21:51 306
原创 Word Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given s = “leetcode”, dict = [“leet”,
2015-09-15 09:21:31 255
原创 Distinct Subsequences
Given a string S and a string T , count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from the original string by deleting some (can be none
2015-09-15 09:21:10 258
原创 Decode Ways
A message containing letters from A-Z is being encoded to numbers using the following mapping: ‘A’ -> 1 ‘B’ -> 2 … ‘Z’ -> 26 Given an encoded message containing digits, determine the total number
2015-09-15 09:20:37 271
原创 Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have the following 3 operations permitted on a word:
2015-09-15 09:20:03 373
原创 Minimum Path Sum
Given a m × n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move either down or right at a
2015-09-15 09:19:29 224
原创 Scramble String
Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = “great”: great / \ gr eat
2015-09-15 09:18:52 355
原创 Interleaving String
Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = ”aabcc”, s2 = ”dbbca”, When s3 = ”aadbbcbcac”, return true. When s3 = ”aadbbbaccc”, return fals
2015-09-15 09:14:27 307
原创 Best Time to Buy and Sell Stock III
Say you have an array for which the i-th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions. Note: You may not e
2015-09-15 09:07:18 219
原创 Maximal Rectangle
Given a 2D binary matrix filled with 0’s and 1’s, find the largest rectangle containing all ones and return its area.
2015-09-15 09:06:57 203
原创 Palindrome Partitioning II
Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning of s. For example, given s = ”aab”, Return 1 si
2015-09-15 09:06:34 209
原创 Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2,1,−5,4], the contiguous subarray [4,−1,2,1] has t
2015-09-14 08:44:38 210
原创 Triangle
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [ [2], [3,4], [6,5,7], [4,1
2015-09-14 08:44:19 204
原创 Container With Most Water
Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i,0). Find two line
2015-09-14 08:43:56 208
原创 Longest Substring Without Repeating Characters
Given a string, 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
2015-09-14 08:43:35 211
原创 Best Time to Buy and Sell Stock II
Say you have an array for which the i-th element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy one
2015-09-14 08:43:10 208
原创 Best Time to Buy and Sell Stock
Say you have an array for which the i-th element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),
2015-09-14 08:42:48 207
原创 Jump Game II
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to
2015-09-14 08:42:27 200
原创 Jump Game
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you
2015-09-14 08:42:01 228
原创 Sqrt(x)
Implement int sqrt(int x). Compute and return the square root of x.
2015-09-14 08:40:55 205
原创 Word Search
Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or vertically n
2015-09-14 08:40:07 229
原创 Sudoku Solver
Write a program to solve a Sudoku puzzle by filling the empty cells. Empty cells are indicated by the character ‘.’. You may assume that there will be only one unique solution.
2015-09-14 08:39:45 185
cocos2d-x3.0物理引擎源码
2014-05-29
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人