- 博客(14)
- 收藏
- 关注
原创 macOs-sdk headers for macos 10.14 该软件包与mac os 不兼容
终端gcc编译遇到不识别常用头文件,网上解决方案是open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg按照安装指引,遇到sdk软件包和mac os 不兼容,解决方案是:sudo rm -rf /Library/Developer/CommandLineToolsxcode-select --installopen /Library/Developer/Comman
2020-06-14 15:25:26
2849
原创 python学习爬虫
看起来挺简单,实践起来各种问题,包括python2和3的语法问题,总算能稍微download下网页上的链接,但是经常出现bug,譬如url中存在编码问题,http版本问题等,后面继续摸索吧。。。#!/usr/bin/env python3import osimport sslfrom html.parser import HTMLParserimport urllib.parse...
2019-10-07 22:04:35
237
原创 【一天一道】Given a linked list, return the node where the cycle begins
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?解题思路:快慢指针,从起点走,快指针步长为2,慢指针步长为1,假设有环,相遇时,快指针走了...
2019-06-28 00:33:56
385
2
原创 【一天一道】统计在从1到n的正整数中指定字符的次数
package leetCode;//ch='0'的场景还没看;要进行区分下/*给定一个十进制正整数N,写下从1开始,到N的所有整数,然后数一下其中出现的所有“1”的个数。以20310为例,计算百位出现1的次数,将其分为a=203,b = 10,百位的高位为20,低位为101、当百位数字小于1时,高位取值0-19,即高位*1002、当百位数字等于1时,高位取值0-19,即高位*1...
2019-06-25 01:18:54
522
原创 【一天一道】You must do this in-place without altering the nodes' values
Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given{1,2,3,4}, reord...
2019-06-21 21:44:13
166
原创 【一天一道】Given a binary tree, return the postorder traversal of its node
For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[3,2,1].Note:Recursive solution is trivial, could you do it iteratively?二叉树遍历方式:前序,后序,中序后序:先左右后根——[3, 2, 1]...
2019-06-21 00:30:12
192
原创 【一天一道】Sort a linked list using insertion sort.
插入排序/*** Definition for singly-linked list.* public class ListNode {* int val;* ListNode next;* ListNode(int x) {* val = x;* next = null;* }* }...
2019-06-19 22:56:30
130
原创 【一天一道】leetcode Sort a linked list in O(n log n) time using constant space complexity.
据说要用归并方法,分而治之:head :左边 mid:右边将链表分为两部分,左边和右边,先找到中间节点,对左边和右边有序数列进行排序,将最新的链表 2 1 || 0 4 / \ ...
2019-06-18 23:30:22
120
原创 【一天一道】八皇后的递归与非递归
递归:public class eightQueue { static int record[] = new int[8]; static int num = 0; static int N = 8; public static void main(String []args){ System.out.println("start*******...
2019-06-14 12:55:32
318
转载 2017.9.8——字符串中的\0
搬运工——http://www.cnblogs.com/andrewlee0708/archive/2013/09/10/str_end.html'\0'就是 字符串结束标志。比如说,把一个字符串赋值给数组:char str1[] = {"Welcome!"}。实际上数组str1在内存中的实际存放情况为: 'W' 'e' 'l' 'c' 'o' 'm' 'e' '!' '\0'。这后面的'\0
2017-09-08 20:40:39
348
转载 C++ 快排算法
参考http://blog.youkuaiyun.com/liuchen1206/article/details/6954074以及http://blog.youkuaiyun.com/morewindows/article/details/6684558边写边想,起初并没理解大佬说的快排就像填坑,写的过程才理解了,过程中遇到很多小问题,针对我的问题做了点细节补充,若有错误欢迎指正!
2017-09-03 17:32:31
4497
2
原创 2018大疆校招软件岗位笔试题目(求有效工作时间)——未在线验证
题目在DJI的工时打卡计算系统中,一个工作日的定义是由工作当日当天的凌晨03:00:00开始,到隔天凌晨03:00:00(不包含)为止。这其中,工作日当天的中午12:30:00到下午14:00:00(不包含)为午休时间,不计入工作时间。Tom由于工作繁忙,担心自己有时候会忘记打卡,因此他每次经过打卡机到时候都会不由自主地打一次卡。为了更好的了解自己的工作情况,Tom找到了自己整个八
2017-08-31 16:43:09
8941
原创 2017年校招全国统一模拟笔试(第五场)DNA
牛牛从生物科研工作者那里获得一段字符串数据s,牛牛需要帮助科研工作者从中找出最长的DNA序列。DNA序列指的是序列中只包括'A','T','C','G'。牛牛觉得这个问题太简单了,就把问题交给你来解决。例如: s = "ABCBOATER"中包含最长的DNA片段是"AT",所以最长的长度是2。#include #include using namespace std;
2017-08-28 21:59:33
455
原创 2017年校招全国统一模拟笔试(第五场)偶串
偶串 (AC)如果一个字符串由两个相同字符串连接而成,就称这个字符串是偶串。例如”xyzxyz”和”aaaaaa”是偶串,但是”ababab”和”xyzxy”却不是。 牛牛现在给你一个只包含小写字母的偶串s,你可以从字符串s的末尾删除1和或者多个字符,保证删除之后的字符串还是一个偶串,牛牛想知道删除之后得到最长偶串长度是多少。输入描述: 输入包括一个字符串s,字符串长度le
2017-08-28 21:51:44
281
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人