-
371. sum of two integers
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3.Credits:Special thanks to @fujiaozhu for adding this problem and creating all test cases.思路: 不用加号咋实现? ...…
-
python字符串
python字符串相关切片name = "baoqiang"print(name[0:6:2])结果:boi切片用例name = "abcefg"name[-1] = gname[-2] = fname[3:6] = efgname[3:-1] = efname[3:] = efgname[-1:-3] = ''name[3:-1] = efname[-1:-3:-1] = gfname[-1:-5:-1] = gfecname[-1:-6:-1] = gfecbname[-1:-7:-1...…
-
octave入门
octave学习移动数据GNU Octave, version 4.4.0Copyright (C) 2018 John W. Eaton and others.This is free software; see the source code for copying conditions.There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY orFITNESS FOR A PARTICULAR PURPOSE. F...…
-
268. missing number
Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.Example 1:Input: [3,0,1]Output: 2Example 2:Input: [9,6,4,2,3,5,7,0,1]Output: 8Note:Your algorithm should run in linear runtime compl...…
-
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.给定一个字符串,确定它是否是回文,只考虑字母数字字符并忽略大小写。注意:出于此问题的目的,我们将空字符串定义为有...…
-
412. fizz buzz
Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For numbers which are multiples of both three and f...…
-
169. majority element
Given 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 element always exist in the array.Example 1:Input: [3,2,3]Out...…
-
python基础语法
一些基本语法输入: input(“请输入密码:”) 注:raw_input——python2name = input("input your name:")算式与算数表达2的三次方:2**3 sin(x) cos(x) tan(x) fmod(x,y):求x/y的余数 ceil(x):取不小于x的最小整数 floor(x):取不大于x的最大整数 fabs(x):求绝对值 exp(x):求e的x次幂 pow(x,y):求x的y次幂 log10(x):求x的10底对数 ...…
-
350. intersection of two arrays ii
Given two arrays, write a function to compute their intersection.给定两个数组,编写一个函数来计算它们的交集。Example:Given nums1 = [1, 2, 2, 1],nums2 = [2, 2],return [2, 2].Note:Each element in the result should appear as many times as it shows in both arrays.The resul...…
-
326. power of three
Given an integer, write a function to determine if it is a power of three.Example 1:Input: 27Output: trueExample 2:Input: 0Output: falseExample 3:Input: 9Output: trueExample 4:Input: 45Output: falseFollow up:Could you do it without using any loop ...…
-
283. move zeroes
Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements.给定一个数组nums,写一个函数将所有0移动到它的末尾,同时保持非零元素的相对顺序。Example: Input: [0,1,0,3,12] Output: [1,3,12,0,0]Note:You must do this...…
-
234. palindrome linked list
Given a singly linked list, determine if it is a palindrome.给出一个单链表,确定它是否是回文。Example 1:Input: 1->2Output: falseExample 2:Input: 1->2->2->1Output: trueFollow up:Could you do it in O(n) time and O(1) space? 思路把链表转化成数组,然后分别从数组的头部和尾部开...…
-
108. convert sorted array to binary search tree
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more...…
-
107 binary tree level order traversal ii
Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree [3,9,20,null,null,15,7], 3 / 9 20 / 15 7return its bott...…
-
分词研究概况
1 分词研究概况主要方法技术: 基于词典匹配 基于规则 基于统计学方法 机器学习方法1.1 基于词典分词 首先,基于词典的分词方法需要从大量预料中提取出常用的词,以建立一个词典。接着,基于词典的匹配方法通过正向/逆向匹配词典,得到所有在词典中出现过的词,并依照最长/最短词匹配的原则,生成分词文本。 缺点: 需要对词典保持更新 需要总结大量文本语料库,较为耗费时间 对于新词识别以及歧义的问题,该方法并不能很好地解决 所以实际应用中,词典...…
-
842复习重点概要
1.842简介 数据结构 45’ 软件工程 45‘ 操作系统 35‘ 计算机网络 25’总分:150 各科目参考书籍,参见2018年招生目录如下图所示: 历年招生目录,录取情况见: https://grawww.nju.edu.cn/912/list.htm 各科复习资料: 《数据结构与算法分析:Java语言描述》(英文版),第2版,机械工业出版社; 《软件工程与计算:软件开发的技术基础》,骆斌主编、丁二玉...…