自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

难不难的博客

本人的一些笔记描述

原创 混合开发引起的couldn't find libflutter.so

couldn’t find libflutter.so需要在 app module下配置如下,主要配置defaultConfig杰殿下的ndk和builTypes下的debug下的ndk和release下的ndkandroid { compileSdkVersion compile_sdk_version buildToolsVersion build_tools_versio...

2019-04-27 17:15:46 1522

原创 flutter混合开发运行报错:VM snapshot must be valid. /Check failed: vm. Must be able to initialize the VM.

在进行混合开发的时候报了如上的错误,google了半天原因就是打包apk时flutter的一些资源找不到,解决办法有各种移动资源文件什么的,但是我不想那么麻烦,而且我建立一个简单的项目是可以加载flutter module,为什么在复杂的工程就出问题了呢?解决办法:先在flutter module所在的项目跑一遍(包含.android的项目),然后运行宿主所在的项目就可以了...

2019-04-23 20:56:46 244

原创 1-2n的数存储在空间为n的数组中,找出出现两次的数字,时间复杂度O(n),空间复杂度O(1)

1-2n的数存储在空间为n的数组中,找出出现两次的数字,时间复杂度O(n),空间复杂度O(1)/*奇数零次 偶数零次 0奇数 一次 偶数 零次 -1奇数 两次 偶数 零次 -2奇数 零次 偶数 一次-3奇数 一次 偶数 一次-4奇数 两次 偶数 一次-5奇数 零次 偶数 两次-6奇数一次 偶数 两次-7奇数两次 偶数两次-8*/public...

2019-04-09 03:04:21 442

原创 分解质因数

void solution(int num) { int i = 2; while (num != 1) { if (num % i == 0) { System.out.println(i); num /= i; } else { i++; } } } 

2018-09-29 15:42:28 492

原创 使用ranN()完成ranM()函数的思想

主要就是利用位的思想,把randN()当成一个生成N进制某一位的一个函数,然后生成M的整数倍,当大于M整数倍的时候重新生成  //rand1()生成0和1 使用ran1()生成0-5 思想用位 生成每一位 二进制111为7 生成大于5的时候重新生成 public int random5(){ int result; do{ ...

2018-09-14 22:12:16 409

原创 两个线程循环交替打印

不加锁,while+boolean变量死循环 public class Solution { volatile static boolean open=false; volatile static int index=0; static String s="adasdfsafwfvgs"; static Thread t1=new Thread(new myRun1(),"线程1...

2018-08-29 17:31:48 4041 4

原创 给定一个包含操作符和数字的字符串数组算结果(栈)

Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "3", "*"] -&g..

2018-06-20 23:15:00 184

原创 区块链的一些概念

何为区块链?其实区块链就是一个区块连接着一个区块,也可以理解为一个单链表,每个区块保存有数据,数据包括本身的一些交易和上个区块的信息等。区块链怎么保证安全?这就要说到区块链的去中心化,去中心化就是没有第三方,比如支付宝就属于第三方,我们为什么相信支付宝,因为他家大业大声誉好,如果你往支付宝存入100元钱,但支付宝不承认你能有什么办法,你没什么办法。去中心化就是去除第三方,区块链的去中心化怎么实现的...

2018-06-19 22:45:12 191

原创 在一个二叉树中找出到子节点的最小深度(树)

public int run(TreeNode root) { if(root==null) return 0; if(root.left==null&&root.right==null) return 1; int leftDepth=0; if(root.left!=...

2018-06-19 22:13:08 888

原创 Valid Sudoku(每行、每列、3x3都为1到9)leetcode36

Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:Each row must contain the digits 1-9 without repetition.Each column must contain t...

2018-06-13 00:11:12 226

原创 Search Insert Position(目标数应该插在数组中的什么位置)leetcode35

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 in the array.Exam...

2018-06-11 23:23:37 109

原创 Search for a Range(在升序数组中找到目标值的左右边界)leetcode34

Given an array of integers nums 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).If the tar...

2018-06-10 22:00:33 226

原创 Search in Rotated Sorted Array(在一个旋转的排序数组以O(logN)查找目标数)leetcode32

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]).You are given a target value to search. If found in t...

2018-06-09 20:48:07 156

原创 Longest Valid Parentheses(左右括号的最大连续合法长度)leetcode32

Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.Example 1:Input: "(()"Output: 2Explanation: The longest valid pare...

2018-06-08 22:13:22 109

原创 Next Permutation(从后往前字典序列升序,否则交换逆序然后输出。。)leetcode31

从后往前按照字典升序数,碰到不是升序的某个数字(i)则和从后往前数大于i的最小值(j)交换,然后i+1到数组末尾的数逆序.如果从尾到头都是字典升序,则整个数组逆序Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If ...

2018-06-07 23:53:10 116

原创 Substring with Concatenation of All Words(字符串数组全排列在给给丁字符串的索引位置)leetcode30

You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and wi...

2018-06-07 01:02:38 138

原创 Divide Two Integers(不用乘除和模算除法)leetcode29

Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividing dividend by divisor.The integer division should ...

2018-06-06 00:12:25 221

原创 Implement strStr()(目标字符串在原字符串的位置)leetcode28

Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Example 1:Input: haystack = "hello", needle = "ll"Output: 2Example 2:Input:...

2018-06-05 00:15:16 98

原创 Remove Element(移除目标值的元素并返回新元素的长度)leetcode27

Given an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you must do this by modifying the input array ...

2018-06-03 19:52:28 157

原创 Remove Duplicates from Sorted Array(移除重复元素并返回长度)leetcode26

Given a sorted array nums, 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 modifying...

2018-06-02 20:38:48 83

原创 Reverse Nodes in k-Group(k个一组反转链表)leetcode25

Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equal to the length of the linked list. If the number of ...

2018-06-02 01:12:57 77

原创 Swap Nodes in Pairs(反转链表相邻两个节点)leetcode24

Given a linked list, swap every two adjacent nodes and return its head.Example:Given 1->2->3->4->5->6, you should return the list as 2->1->4->3->6->5.Note:Your algorithm ...

2018-05-31 23:06:04 149

原创 Merge k Sorted Lists(合并k个有序链表)leetcode23

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.Example:Input:[  1->4->5,  1->3->4,  2->6]Output: 1->1->2->3->4->4...

2018-05-31 00:15:38 651

原创 Generate Parentheses(左右括号的全排列)leetcode22

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:[ "((()))", "(()())", "(())()", "()(())", "...

2018-05-30 00:51:50 287

原创 Merge Two Sorted Lists(合并有序链表)leetcode21

code1:(常规解法)public ListNode mergeTwoLists(ListNode l1, ListNode l2) { if(l1==null) return l2; if(l2==null) return l1; ListNode head=null; ListNo...

2018-05-28 22:26:47 90

原创 Valid Parentheses(左右小括号中括号大括号匹配)leetcode20

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of brack...

2018-05-27 21:50:28 136

原创 Remove Nth Node From End of List(删除链表的倒数第n个节点)leetcode19

Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the li...

2018-05-26 22:05:36 72

原创 4Sum(4个数的和为target的集合)leetcode18

Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of tar...

2018-05-25 22:54:58 130

原创 Letter Combinations of a Phone Number(键盘字符的组合)leetcode17

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given...

2018-05-24 22:57:46 108

原创 3Sum Closest(最接近target的三个数字的和)leetcode16

Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would ...

2018-05-23 23:10:23 116

原创 3Sum(在一个数组中找到三个数字的和为0不重复)leetcode15

Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not contain ...

2018-05-22 23:52:44 394

原创 Longest Common Prefix(字符串数组的最长前缀)leetcode14

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","flight"]Output: "fl"E...

2018-05-21 22:56:48 182

原创 Roman to Integer(罗马数转为整数)leetcode13

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D 5...

2018-05-20 23:48:22 50

原创 Integer to Roman(整型转为罗马数)leetcode12

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D 5...

2018-05-20 00:09:46 486

原创 Container With Most Water (最大盛水量)leetcode11

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 ...

2018-05-19 00:01:37 1537

原创 Regular Expression Matching(正则表达式匹配) leetcode10

Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.'.' Matches any single character.'*' Matches zero or more of the preceding element.The...

2018-05-18 00:59:44 84

原创 Palindrome Number(判断一个整数是否是回文串) leetcode9

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: falseExplanation: F...

2018-05-16 23:24:53 624

原创 String to Integer (atoi) leetcode8

Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this ...

2018-05-16 00:23:07 90

原创 整形数字反转 leetcode7

example1:input:123output:321example2:input:-123output:-321example3:input:230output:32主要注意整型数字反转后超出范围code1:public int reverse(int x) { String s=x+""; char[] ss=s.toCharArray();...

2018-05-15 00:03:31 133

原创 Z字形打印问题leetcode6

b'j

2018-05-13 23:34:31 191

提示
确定要删除当前文章?
取消 删除