达则兼济天下,穷则独善其身。
能力说明:
了解变量作用域、Java类的结构,能够创建带main方法可执行的java应用,从命令行运行java程序;能够使用Java基本数据类型、运算符和控制结构、数组、循环结构书写和运行简单的Java程序。
暂时未有相关云产品技术能力~
阿里云技能认证
详细说明请求信息的取得 当请求来到服务器时,Web容器会创建HttpServletRequest实例来包装请求中的相关信息,HttpServletRequest接口继承自ServletRequest接口,后者定义了取得一些通用请求信息的方法,如getParameter()、getInputStream()等方法,前者定义了取得HTTP相关信息的方法,例如getHeader()、ge
1 实现Runnable线程案例 使用() -> {} 替代匿名类: //Before Java 8: new Thread(new Runnable() { @Override public void run() { System.out.println("Before Java8 "); } }).start();
1 最坏情况下,合并两个大小为n的已排序数组所需要的比较次数为2n-1。 2 声明一个指向含有10个元素的数组的指针,其中每个元素是一个函数指针,该函数的返回值是int,参数是int*,正确的是() int ((int *)[10])*p 3 任何一个非空广义表其表头可能是原子,也可能是列表,而其表尾必定是列表。 4 若广义表LS(n>=1)非空,则a1是LS的表
顺时针打印链表 void Matrix(vector<vector<int>>& num, int x1, int y1, int x2, int y2) { int n = 1; while (x1 <= x2 && y1 <= y2) { int i = x1, j =
C++的标准不允许复制构造函数传值参数。A(const A& other){},如果是传值参数,把形参复制到实参会调用复制构造函数,就会形成无休止的递归调用从而导致栈溢出。 赋值运算符函数 class CMyString { public: CMyString(char *pData = NULL); CMyString(const CMySt
空格替换 题目描述 请编写一个方法,将字符串中的空格全部替换为“%20”。假定该字符串有足够的空间存放新增的字符,并且知道字符串的真实长度(小于等于1000),同时保证字符串由大小写的英文字母组成。 给定一个string iniString 为原始的串,以及串的长度 int len, 返回替换后的string。 测试样例: “Mr John Smith”,13 返
转化XML import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.io.SAXReader; public class Foo { public Document parse(URL url) throws DocumentException {
使用这种方式解析时,需要使用node.getNodeType() == Node.ELEMENT_NODE判断结点是否为元素结点,否则会输出很多#text(结点前有空格存在的原因)。 完成的XML解析和生成代码如下: package test; import java.io.*; import javax.xml.parsers.DocumentBuilder; i
学习简单导航制作,常见导航有如下样式: w3school导航 网易首页导航 以上两种分别可以用ul和div来制作,直接上代码: test.html: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html;c
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the thi
Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i]. Solve it without division
Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each time the slidi
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Given nums = [-2, 0, 3, -5, 2, -1] sumRange(0, 2) -> 1 sumRang
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to right. Integ
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right. The first integer
Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *. Exam
Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may contain letters other than the parentheses
Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return false. Note: You
Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are: [“1->2->5”, “1->3”
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has o
Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. For example: G
Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it wi
Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without
定义:为创建一组相关或相互依赖的对象提供一个接口,而且无需指定他们的具体类。 抽象工厂模式是工厂方法模式的升级版本,他用来创建一组相关或者相互依赖的对象。他与工厂方法模式的区别就在于,工厂方法模式针对的是一个产品等级结构;而抽象工厂模式则是针对的多个产品等级结构。在编程中,通常一个产品结构,表现为一个接口或者抽象类,也就是说,工厂方法模式提供的所有产品都是衍生自同一个接口或
Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the
Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ug
Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2. Note: Your algorithm
Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231−12^{31} - 1. For example, 123 -> “One Hundred Twenty Three” 1234
Follow up for H-Index: What if the citations array is sorted in ascending order? Could you optimize your algorithm? Hint: Expected runtime complexity is in O(log n) and the input is sort
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher’s h-index. According to the definition of h-index on Wikip
You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed b
Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, given n = 12, return 3 because 12 = 4 + 4 + 4; give
Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation – it essentially peek() at the element that wi
Given a string containing just the characters '(',')','{','}', '[' and ']', determine if the input string is valid. The brackets must close in the correct order, "()" and "()[]{}" are all
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. For example, given nums = [0, 1, 0, 3, 12], after call
According to the Wikipedia’s article: “The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.” Given a board
Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s
Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value. Examples: [2,3,4] , th
Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection
Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest increasing subsequence is [2, 3, 7, 1
You are playing the following Bulls and Cows game with your friend: You write a 4-digit secret number and ask your friend to guess it. Each time your friend guesses a number, you give a hin
Ant 是一个将软件编译、测试、部署等步骤联系在一起加以自动化的一个工具,大多用于Java环境中的软件开发。 安装和配置 下载ant,http://ant.apache.org/。 解压压缩包,如放置在F:\chuxing\apache-ant-1.9.6,目录结构如下: bin是ant的程序运行入口。 etc中存放的是一些xsl的输出模板。 lib中存放的是an
命令描述 MS-DOS Linux Linux Example 复制文件 copy cp cp this.ext that.txt 移动文件 move mv mv this.txt dir/ 列出文件 dir ls ls -l 清除屏幕 cls clear clear 关闭命令窗口 exi
1 表示数字 #include <iostream> #include <string> using namespace std; int main() { string str; while (cin>>str) { string res = ""; for (int i =
1 字符串最后一个单词的长度 #include <iostream> using namespace std; int main() { char ch[128]; while (cin.getline(ch, 128)) { int len = 0; for (int i = 0; ch[i] !=
1 查找第一个只出现一次的字符 #include <iostream> #include <cstring> #include <cstdio> using namespace std; bool findChar(char *str, char *ch); int main() { char str[100];
注意 int main() { int n; cin>>n; while (n--) { char ch[100]; cin>>ch; //此处用gets(ch)或者cin.getline(ch,100)出现问题 //原因在于输入n后残留了一个回车键
八皇后问题是一个古老而著名的问题,它是回溯算法的典型例题。该问题是十九世纪德国著名数学家高斯于1850年提出的:在8行8列的国际象棋棋盘上摆放着 八个皇后。若两个皇后位于同一行、同一列或同一对角线上,则称为它们为互相攻击。 现在要求使这八个皇后不能相互攻击,即任意两个皇后都不能处于同一行、同一列或同一对角线上,问有多少种摆法。 解题思路 在递归方式中,pos[i]表
Windows系统为我们提供了相关API,我们可以使用它们来进行多线程编程。 创建线程的函数: HANDLE CreateThread( LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD SIZE_T dwStackSize, // initial stack
环境准备 codeblocks 1 Settings–Compiler–Linker Settings中添加~\CodeBlocks\MinGW\lib\libwsock32.a 2 #include <winsock2.h> vs2010 #include <winsock2.h> #pragma comment(lib, "ws2