![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法分析与设计
文章平均质量分 61
我是三少爷的剑
今年选了算法分析与设计。。。平时作业语言自己选。。考试只能是C语言和C plus plus。
反正我选了,慢慢进步吧,三少爷的剑。
展开
-
算法分析与设计——LeetCode刷题之TwoSum(easy)
这是上了第一节选法分析与设计之后再老师指定的网站LeetCode上打的题目,这门课的重点不是如何去编写代码而是如何用代码实现算法。原创 2017-09-07 00:44:35 · 225 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之Decode Ways
题目:A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the t原创 2018-01-07 19:55:29 · 192 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之 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 v原创 2018-01-07 14:23:38 · 126 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之 Spiral Matrix
题目:Given a matrix of m x 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原创 2018-01-07 14:19:47 · 156 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之 Climbing Stairs
题目: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-01-07 14:16:41 · 187 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之 Merge k Sorted Lists
题目:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.答案:public class Solution { public ListNode mergeKLists(List lists) {原创 2018-01-07 14:12:41 · 208 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之Remove Duplicates from Sorted Array
题目:Given a sorted array, remove the duplicates in-place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this by m原创 2018-01-07 14:08:22 · 120 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之Valid Parentheses
题目:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are原创 2018-01-07 14:04:22 · 155 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之Search for a Range
题目:Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).原创 2018-01-11 22:10:17 · 175 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之 Rotate Image
题目:You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-place, which means you have to modify the inpu原创 2018-01-11 22:07:15 · 150 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之Merge Two Sorted Lists
题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1->1原创 2018-01-03 00:57:30 · 190 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之4Sum
题目:Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.Note: The s原创 2018-01-03 00:53:51 · 159 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之Reverse Integer
算法作业原创 2017-09-25 00:21:40 · 148 阅读 · 0 评论 -
算法分析与设计——leetcode刷题之Add Two Numbers(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 two numbers and...原创 2017-09-11 12:14:35 · 182 阅读 · 0 评论 -
算法分析与设计课程——LeetCode刷题之 Pow(x, n)
题目:Implement pow(x, n).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100答案:class Solution {public: double pow(double x, int原创 2018-01-07 20:00:14 · 139 阅读 · 0 评论