- 博客(35)
- 收藏
- 关注
原创 [LeetCode 14] Longest Common Prefix
Longest Common PrefixDescriptionExampleSolutionSummary[Problem Link]DescriptionWrite a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, r...
2019-04-24 18:34:09 135
原创 [LeetCode 6] ZigZag Conversion
Palindrome NumberDescriptionExampleSolution 1Solution 2Summary[Problem Link]DescriptionThe string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may want ...
2019-04-23 22:06:32 141
原创 [LeetCode 9] Palindrome Number
Palindrome NumberDescriptionExampleSolution 1Solution 2Summary[Problem Link]DescriptionDetermine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as fo...
2019-04-21 02:20:00 179
原创 [LeetCode 8] String to Integer (atoi)
@[TOC](String to Integer (atoi))[Problem Link]DescriptionImplement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first...
2019-04-21 01:35:34 134
原创 [LeetCode 7] Reverse Integer
Reverse IntegerDescriptionExampleSolutionSummary[Problem Link]DescriptionGiven a 32-bit signed integer, reverse digits of an integer.ExampleInput: 123Output: 321Input: -123Output: -321Input...
2019-04-20 23:19:16 96
原创 [LeetCode 3] Longest Substring Without Repeating Characters
Add Two NumbersDescriptionExampleSolution 1Summary[Problem Link]DescriptionGiven a string, find the length of the longest substring without repeating characters.ExampleInput: "abcabcbb"Output: 3...
2019-04-18 07:29:09 100
原创 [LeetCode 2] Add Two Numbers
Add Two NumbersDescriptionExampleSolution 1Solution 2Summary[Problem Link]DescriptionYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in revers...
2019-04-18 05:27:56 101
原创 [LeetCode 1]Two Sum
Two SumDescriptionExampleSolution 1Solution 2Problem LinkDescriptionGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that eac...
2019-04-17 22:25:11 77
原创 python GroupBy对象函数应用
python GroupBy对象函数应用函数应用经常结合numpy库与lamda来使用GroupBy.apply(func, *args, **kwargs)聚合函数: GroupBy.aggregate(func, *args, **kwargs) 可以使用字符串简写相应的算法比如: GroupBy.agg({“column1”:”sum”,”column2”:”mea...
2018-05-30 10:05:58 1009
原创 算法NP-complete Ex8.3
Ex8.3题目: In the HITTING SET problem, we are given a family of sets{S1,S2,...,SnS_{1},S_{2},...,S_{n}} and a budget b, and we wish to find a set H of size ≤\le b which intersects every SiS_{i}, if s
2018-01-11 22:34:33 203
原创 Merge Two Binary Trees [LeetCode 617]
题目链接Answer/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * };
2017-12-26 22:14:19 131
原创 Big Countries [LeetCode 595]
Analysis程序普遍要与数据库打交道,所以要了解基本的SQL语句。Answer# Write your MySQL query statement belowSELECT name, population, areaFrom WorldWHERE population > 25000000 or area > 3000000
2017-12-20 10:47:48 148
原创 Reverse Integer [LeetCode 7]
Analysis边界问题要考虑,题目中范围是32位的有符号数,所以为[−231,+231−1][-2^{31},+2^{31}-1]。Answer#include <iostream>#include <sstream>#include <math.h>using namespace std;class Solution {public: int reverse(int x) {
2017-12-20 10:40:32 116
原创 Add Two Numbers[LeetCode 2]
Answerclass Solution {public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { int temp1 = 0, temp2 = 0; ListNode* t1 = l1; ListNode* t2 = l2; ListNode* ans =
2017-12-19 12:13:14 94
原创 文章标题
一、在解调过程中,如何从NTSC的色度信号C中提取出Q信号?NTSC制是1953年由美国国家电视制式委员会(National Television System Committee)提出的,这一制式是在正交平衡调制之前,将被压缩的色差信号U、V又进行了一定的变换,从而产生了I、Q信号,这样做,可对色差信号的频带进行进一步的压缩。选用Y、I、Q的主要原因是由于这些国家原有的黑白电视视频带宽较窄(
2017-12-04 23:35:20 362
原创 Move Zeroes[LeetCode 283]
Ansclass Solution {public: void moveZeroes(vector<int>& nums) { int lastNonZeroFoundAt = 0; for (int cur = 0; cur < nums.size(); cur++) { if (nums[cur] != 0) {
2017-12-04 10:52:53 133
原创 Max Consecutive Ones[LeetCode 485]
Ans#include <iostream>#include <vector>using namespace std;class Solution {public: int findMaxConsecutiveOnes(vector<int>& nums) { int ans = 0; int temp = 0; for (int i =
2017-12-04 10:02:27 124
原创 Array Partition I[LeetCode 561]
Ans#include <iostream>#include <vector>#include <algorithm>using namespace std;class Solution {public: int arrayPairSum(vector<int>& nums) { sort(nums.begin(), nums.end()); int a
2017-12-04 09:55:23 127
原创 Two Sum[LeetCode 1]
Ans#include <iostream>#include <unordered_map>#include <vector>using namespace std;class Solution {public: vector<int> twoSum(vector<int>& nums, int target) { vector<int> ans; u
2017-12-04 09:40:20 105
原创 1-bit and 2-bit Characters[Leetcode 717]
Ansclass Solution {public: bool isOneBitCharacter(vector<int>& bits) { int i = 0; int size = bits.size(); if (size == 1) { if (bits[0] == 0) return true;
2017-12-02 13:37:45 132
原创 Find Pivot Index[Leetcode 724]
Ans#include <iostream>using namespace std;class Solution {public: int pivotIndex(vector<int>& nums) { int lsum = 0; int rsum = 0; int sum = 0; int len = nums.size(
2017-12-02 12:36:18 154
原创 编译原理5、6
5.1(1) S−>(L)|aS -> (L) | a L−>SL′L -> SL' L′−>,SL′|ℇL'-> ,SL' | ℇ First(SS) = {(,a}\{(, a\} First(LL) = {(,a}\{(, a\} First(L′L') = {,}\{,\} Follow(SS) = {,,)}\{^{,} , )\} Follow(LL) = {)}\{
2017-11-20 10:18:36 335 1
原创 Best Time to Buy and Sell Stock with Transaction Fee[LeetCode 714]
Ans#include <iostream>#include <vector>#include <cstring>using namespace std;class Solution {public: int maxProfit(vector<int>& prices, int fee) { int size = prices.size(); vec
2017-10-30 22:33:33 273
原创 Postfix后缀表达式实验报告
实验目的通过使用一个Java语言编写的能将算术表达式翻译为等价后缀形式的语法制导翻译器,对语言处理程序有一个初步的认识。实验环境jdk1.8; Eclipse neon实验过程将类 Parser 的成员 lookahead 声明为 staticdhgiusgbregwelug尾递归出现在 rest() 中,消除尾递归之后的函数 rest()如下:void rest() {while (true
2017-10-22 10:25:45 747
原创 Symmetric Tree [LeetCode 101]
Answer#include <iostream>using namespace std;struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {}};class Solution {public:
2017-10-20 22:19:44 139
原创 Minesweeper [LeetCode 529]
Answer#include <vector>#include <iostream>using namespace std;class Solution {public: vector<vector<char> > updateBoard(vector<vector<char> >& board, vector<int>& click) { if (board[clic
2017-10-20 00:06:49 187
原创 Maximum Depth of Binary Tree [LeetCode 104]
DescriptionGiven a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.Answer/** * Definition for a bi
2017-10-18 19:29:20 133
原创 编译原理作业3、4
Exercise 3.1<function> <id, 1> <(> <id, 2> <,> <id, 3> <:> <integer> <;><{> <const, "return the maximum of integer i and j"> <}><begin><if> <id, 2> <>> <id, 3> <then> <id, 1> <:> <=> <id, 2><else>
2017-10-11 11:17:21 642
原创 24 game [LeetCode 679]
DescriptionYou have 4 cards each containing a number from 1 to 9. You need to judge whether they could operated through *, /, +, -, (, ) to get the value of 24.Example 1: Input: [4, 1, 8, 7] Output:
2017-09-28 17:43:36 534
原创 Majority Element [LeetCode 169]
DescriptionGiven an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority elem
2017-09-11 01:09:23 171
原创 TPC-H linux下生成数据表
1. 下载TPC-Hhttp://www.tpc.org/tpc_documents_current_versions/current_specifications.asp 2. 解压后文件夹内有一个DBGEN文件夹解压后文件夹内有一个DBGEN文件夹,进入这个文件夹,找到makefile-suite文件,复制一份并将其重命名为makefile。将makefile的四个地方修改成如下图所示3. 生
2017-05-03 09:06:27 658
原创 Unity 3d 学习笔记
如何应用左手法则决定视图,应用 Field of view 设置场景大小。1.场景视图的右上角是场景Gizmo,这个显示场景相机的当前方向,并允许你迅速修改视图角度,Unity中默认是左手法则视图。 2.选中Main Camera,在右侧的inspector栏调整Field of view大小。 添加一个 Empty 游戏对象, 添加一个 Camera 部件(Rendering 分类
2017-03-19 19:45:34 274
原创 unity_3d基础知识
Unity 3D基础知识解释对象与资源的区别与联系,根据官方案例,分别总结资源和对象组织的规则/规律。资源(Asset)是硬盘中的文件,存储在Unity工程的Assets文件夹内。例如,纹理(Texture),材质(Material)和FBX文件等,它们都是资源。一些资源的数据格式是Unity原生支持的,例如材质。有些资源则需要转换为原生的数据格式后才能被Unity使用,例如FBX文件。Unit
2017-03-05 21:39:55 322
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人