- 博客(21)
- 收藏
- 关注
原创 自学报告
Vi,Java,Ant和Junit的自学报告 一、Vi The vi editor is the standard editor for all Unix and Linux systems and its power is not inferior to any of the latest text editors. It is greatly different with other comm...
2019-11-17 12:41:14 110
原创 算法分析与设计作业
算法分析与设计作业题 作业来源(hard) public class Solution { public int longestValidParentheses(String s) { if(s == null || s.length()<=1) return 0; int count = 0, max=0, depth = 0; f...
2019-01-06 15:54:52 152
原创 算法分析与设计作业
算法分析与设计作业题 作业来源(Medium) 我们可以用一个map来实现,map保存的key-val值为string中字符的值以及它上一次出现的位置,index表示没有重复字符字符串的首字符位置,i代表没有重复字符字符串的最右位置。每次遍历到i时,如果map不包含s.charAt(i),则计算长度i-len+1,否则,更新index位置。然后再计算长度。一次遍历之后就可以得到结果。 class...
2019-01-06 14:19:20 174
原创 算法分析与设计期末项目
问题描述 Suppose there are n facilities and m customers.We wish to choose: which of the n facilities to open the assignment of customers to facilities The objective is to minimize the sum of the opening c...
2018-12-29 21:35:07 296
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 (hard) There are two sorted arrays nums1 and nums2 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)). You m...
2018-12-29 16:29:31 134
原创 算法分析与设计作业
算法分析与设计作业题 作业来源(Medium) You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the ...
2018-12-29 16:08:51 151
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 本题求一个树是否是平衡树。可以采用深度优先遍历,计算树的高度,如果左右子树高度差超过1,则返回-1 . class Solution { public: int isBalancedHelper(TreeNode* root) { if(root == NULL) return 0; int leftHeight ...
2018-12-08 19:29:53 126
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) ...
2018-12-02 14:19:58 135
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) ...
2018-12-02 14:04:17 227 1
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally identical and the nodes have the same v...
2018-11-17 23:21:21 181
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note: The number of elements initialized in nums1 and nums2 are m and n respectively. You m...
2018-11-17 22:38:01 256
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Note: Given n will...
2018-11-13 16:08:22 146
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1 or 0. Example 1: Input: a = “11”, b = “1” Output:...
2018-11-02 15:19:23 141
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stored such that the most significant digit is at the head of the list, a...
2018-11-02 15:03:21 108
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 Given a string s consists of upper/lower-case alphabets and empty space characters ’ ', return the length of last word in the string. If the last word does not exist, return 0. Note: A...
2018-11-02 14:49:46 126
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Input: [-2,1,-3,4,-1,2,1,-5,4], Output...
2018-11-01 20:45:12 126
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates ...
2018-11-01 19:36:05 125
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string “”. Example 1: Input: [“flower”,“flow”,“flig...
2018-11-01 18:51:16 90
原创 算法分析与设计作业
算法分析与设计作业题 作业来源 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. Symbol Value I 1 V 5 X 10 L 50 C 10...
2018-10-28 21:32:00 371
原创 算法分析与设计作业
算法分析与设计作业题 Palindrome Number Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward. Example 1: Input: 121 Output: true Example 2: Input: -...
2018-10-21 19:38:07 96
原创 算法分析与设计作业
算法分析与设计作业题 Two Sum Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you ma...
2018-10-14 23:14:02 156
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人