- 博客(80)
- 资源 (1)
- 收藏
- 关注
原创 Leetcode 171. Excel Sheet Column Number
Given a column title as appear in an Excel sheet, return its corresponding column number.For example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> ...
2019-02-28 20:41:04 101
原创 Leetcode 169. Majority Element
Given an array of sizen, find the majority element. The majority element is the element that appearsmore than⌊ n/2 ⌋times.You may assume that the array is non-empty and the majority element alwa...
2019-02-28 20:33:22 76
原创 Leetcode 168. Excel Sheet Column Title 26进制
Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -&g...
2019-02-28 20:29:45 155
原创 Leetcode 167. Two Sum II - Input array is sorted map的使用
Given an array of integers that is alreadysorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers ...
2019-02-28 19:52:36 105
原创 Leetcode 165. Compare Version Numbers比较版本号
Compare two version numbersversion1andversion2.Ifversion1>version2return1;ifversion1<version2return-1;otherwise return0.You may assume that the version strings are non-empty an...
2019-02-28 17:43:07 137
原创 Leetcode 164. Maximum Gap
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Return 0 if the array contains less than 2 elements.Example 1:Input: [3,6,9,1]Output: 3...
2019-02-28 14:20:01 79
转载 网络地址转换NAT原理及其作用
1概述1.1简介NAT英文全称是“NetworkAddressTranslation”,中文意思是“网络地址转换”,它是一个IETF(InternetEngineeringTaskForce,Internet工程任务组)标准,允许一个整体机构以一个公用IP(InternetProtocol)地址出现在Internet上。顾名思义,它是一种把内部私有网络地址(IP地址)翻译...
2019-02-28 14:06:56 3449
转载 安卓代码中如何设置控件TextView为不可见
通常控件的可见与不可见分为三种情况。第一种 gone 表示不可见并且不占用空间第二种 visible 表示可见第三种 invisible 表示不可见但是占用空间可见与不可见的表现形式有两种。在Xml中配置:android:visibility="gone" android:visibility="visible" ...
2019-02-26 11:58:13 3084
原创 安卓一个Activity加载多个layout布局文件
博客后 附上工程文件效果图: 看下工程结构:MainActivity.java文件package com.example.pro225;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.Menu;impo...
2019-02-26 11:38:09 5321
原创 Leetcode 162. Find Peak Element
A peak element is an element that is greater than its neighbors.Given an input arraynums, wherenums[i] ≠ nums[i+1], find a peak element and return its index.The array may contain multiple peaks,...
2019-02-24 15:40:03 87
原创 Leetcode 160. Intersection of Two Linked Lists找出两个链表的第一个共同结点
Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:begin to intersect at node c1.Example 1:Input: ...
2019-02-24 14:55:18 199 1
原创 Leetcode 155. Min Stack实现一个栈,要求实现出栈,入栈,返回最小值的操作,时间复杂度为O(1)
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top() -- Ge...
2019-02-24 14:24:14 157
原创 Leetcode 154. Find Minimum in Rotated Sorted Array II
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).Find the minimum element.The array may contai...
2019-02-24 14:12:52 180
原创 Leetcode 153. Find Minimum in Rotated Sorted Array
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7]might become [4,5,6,7,0,1,2]).Find the minimum element.You may assume no du...
2019-02-24 14:09:42 137
原创 Leetcode 152. Maximum Product Subarray vector二维数组初始化赋值复习
Given an integer arraynums, find the contiguous subarray within an array (containing at least one number) which has the largest product.Example 1:Input: [2,3,-2,4]Output: 6Explanation:[2,3] h...
2019-02-23 16:18:49 326
原创 Leetcode 151. Reverse Words in a String反转字符串,去除空格
Given an input string, reverse the string word by word.Example: Input: "the sky is blue",Output: "blue is sky the".Note:A word is defined as a sequence of non-space characters. Input stri...
2019-02-23 15:50:10 267
原创 Leetcode 149. 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.Example 1:Input: [[1,1],[2,2],[3,3]]Output: 3Explanation:^|| o| o| o +-----...
2019-02-23 14:24:42 232
转载 Android.widget,textView cannot be cast to android.widget.button
是ADT的问题Project -> Clean 清理一下项目参考链接:https://blog.csdn.net/chunyang_guo/article/details/14125229https://blog.csdn.net/ggbb190/article/details/34859639
2019-02-22 19:13:12 1454
原创 C++数字转string,string转数字函数总结
数字转string,这些都可以std::to_string(int)std::to_string(long)std::to_string(long long)std::to_string(float)std::to_string(double)std::to_string(long double)头文件:string.h#include<bits/stdc+...
2019-02-21 20:53:58 16391 5
原创 Leetcode 150. Evaluate Reverse Polish Notation后缀表达式计算
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Note:Division between two integers ...
2019-02-21 20:46:13 165
原创 Leetcode 148. Sort List
Sort a linked list inO(nlogn) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5->3->4->0Output: -1-...
2019-02-21 20:31:58 114 1
原创 Leetcode 147. Insertion Sort List复习快速排序
Sort a linked list using insertion sort.A graphical example of insertion sort. The partial sorted list (black) initially contains only the first element in the list.With each iteration one element...
2019-02-21 20:25:36 134
原创 Leetcode 143. Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You may not modify the values in the list's nodes, only nodes itself may be changed.Example 1:Given 1->2-...
2019-02-20 22:09:14 96
原创 Leetcode 145. Binary Tree Postorder Traversal二叉树后序遍历
Given a binary tree, return thepostordertraversal of its nodes' values.Example:Input:[1,null,2,3] 1 \ 2 / 3Output:[3,2,1]题目链接:https://leetcode.com/problems/binary-tree-...
2019-02-20 21:44:18 199
原创 Leetcode 144. Binary Tree Preorder Traversal二叉树前序遍历
Given a binary tree, return thepreordertraversal of its nodes' values.Example:Input:[1,null,2,3] 1 \ 2 / 3Output:[1,2,3]题目链接:https://leetcode.com/problems/binary-tree-p...
2019-02-20 21:41:06 181
原创 Leetcode 142. Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.To represent a cycle in the given linked list, we use an integerposwhich represents the position (0-i...
2019-02-19 21:23:15 172 1
原创 Leetcode 141. Linked List Cycle快慢指针判断带环链表
Given a linked list, determine if it has a cycle in it.To represent a cycle in the given linked list, we use an integerposwhich represents the position (0-indexed)in the linked list where tail co...
2019-02-19 21:13:35 230 1
原创 关于emplace_back()和push_back()的比较
今天参考别人的代码,发现别人在使用emplace_back()而不是push_back(),我就去查了一下,发现原因是这样的:emplace_back能就地通过参数构造对象,不需要拷贝或者移动内存,相比push_back能更好地避免内存的拷贝与移动,使容器插入元素的性能得到进一步提升。那我们动手比较一下:先看push_back()#include<bits/stdc++.h...
2019-02-19 20:33:34 1862
原创 Leetcode 140. Word Break II
Given a non-empty string s and a dictionary wordDictcontaining a list of non-empty words, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible s...
2019-02-19 20:15:36 166
原创 Leetcode 139. Word Break dp以及kmp的失败尝试
Given anon-emptystringsand a dictionarywordDictcontaining a list ofnon-emptywords, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.Note:The ...
2019-02-18 20:54:37 228
原创 Leetcode 133. Clone Graph
Given the head of a graph, return a deep copy (clone) of the graph. Each node in the graph contains a label (int) and a list (List[UndirectedGraphNode]) of its neighbors. There is an edge between the ...
2019-02-15 17:16:12 75
原创 Leetcode 138. Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.题目链接:https://leetcode.com/problems...
2019-02-15 16:31:21 94 1
原创 Leetcode 137. Single Number II
Given anon-emptyarray of integers, every element appearsthreetimes except for one, which appears exactly once. Find that single one.Note:Your algorithm should have a linear runtime complexity....
2019-02-15 15:44:51 84
原创 Leetcode 136. Single Number
Given anon-emptyarray of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without us...
2019-02-15 15:37:49 87
原创 Leetcode 132. Palindrome Partitioning II dp
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs.Example:Input:"aab"Output: 1Explana...
2019-02-14 18:24:25 346
原创 Leetcode 131. Palindrome Partitioning
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.Example:Input:"aab"Output:[ ["aa","b"], ["a","a"...
2019-02-13 14:50:50 103
原创 Leetcode 129. Sum Root to Leaf Numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the tota...
2019-02-13 14:20:28 110
原创 Leetcode 125. Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.Note: For the purpose of this problem, we define empty string as valid palindrome.Examp...
2019-02-13 14:07:03 90
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人