I think it is clearer than what I see ~ Class solution {public: treenode * ltob (listnode * head, listnode * End) {If (Head = END) {treenode * node = new treenode (Head-> Val ); return node;} listnode * slow = head, * fast = head, * pre = NULL;
You are given two linked lists representing two non-negative numbers. the digits are stored in reverse order and each of their nodes contain a single digit. add the two numbers and return it as a linked list. Input:(2-> 4-> 3) + (5-> 6-> 4)Output:7->
He Himalayas
Time Limit: 2 seconds memory limit: 65536 KB
As an artist, Bob usually need to travel around the world. he made a lot of sketch of scenery on his journey. A famous spot he have visited recently is the Himalayas. the Himalayas is
Pretty poem
Time Limit: 2 seconds memory limit: 65536 KB
Poetry is a form of literature that uses aesthetic and rhythmic qualities of language. there are too famous poets in the contemporary era. it is said that a few ACM-ICPC contestants
Calculate the maximum and minimum values of the array. You can traverse the array and record the maximum and minimum values respectively. This method requires 2n comparisons. If you want to reduce the number of comparisons, You can traverse the
Given two binary trees T1 and T2, determine whether T1 is a child tree of T2.
First, find the root node of T1 in T2. If not,
T1 is not a child tree of T2. If we can find it, we can
Traverse T1 and check whether each node of T1 exists
A volcanic island
Time Limit: 2 seconds memory limit: 65536 kb Special Judge
An underwater volcano has erupted massively in somewhere of the deep Atlanta ocean. This large eruption led to the birth of a new volcanic island, which had a shape
250: simple question
class RunningAroundPark {public:int numberOfLap(int N, vector d){ int n=d.size(); int ans=1,last=-1; for(int i=0;i
500: Find the rule, simple question
class PotentialGeometricSequence {public:int
1. Optimization ideas
(1) Upgrade the server hardware to a faster and larger machine.
(2) Increase the number of servers.
(3) carefully tuning the system and applications to improve performance indicators for response time, throughput, and resource
(1) plural
Multiple numbers can be input directly according to the expression (do not use variables whenever possible), or between numbers and virtual parts *
Example:
>> num=3+4inum = 3.0000 + 4.0000i>> num=3+4*inum = 3.0000 + 4.0000iComplex
1. Bubble Sorting
Note: the outer loop indicates the maximum number of records executed by the Bubble sorting. The inner loop does not depend on the outer loop. It bubbles from the back to the front to reduce the number of cycles.
Void bubblesort
Divide two integers
Divide two integers without using multiplication, division and mod operator.
Analysis: Division is implemented without multiplication, division, and modulo operations. Since each integer can be written as an * 2 ^ N + ...... + A0
Question link: http://poj.org/problem? Id = 1543
DescriptionFor hundreds of years Fermat's last theorem, which stated simply that for N> 2 there exist no integers A, B, c> 1 such that a ^ n = B ^ N + C ^ N, has remained elusively unproven. (A
Randomforest
I. algorithm Introduction
Randomforest is a simple but effective algorithm. Its core idea is to train and combine different decision trees to form a forest. The final classification result is determined by the voting of these
Question link: http://acm.zju.edu.cn/onlinejudge/showProblem.do? Problemid = 5342
A volcanic island
Time Limit: 2 seconds memory limit: 65536 kb Special Judge
An underwater volcano has erupted massively in somewhere of the deep Atlanta
Cattime limit: 2000/1000 MS (Java/others) memory limit: 32768/32768 K (Java/Others)
Total submission (s): 451 accepted submission (s): 100
Special Judge
Problem descriptionthere is a Cat, cat likes to sleep.
If he sleeps, he sleeps continuously no
Insertion Sort list
Sort a linked list using insertion sort.
Answer
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { * val = x; * next = null; * } * }
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.
Some examples:
["2", "1", "+", "3", "*"] -> ((2 + 1) * 3)
Evaluate reverse Polish notation
GivenNPoints on a 2D plane, find the maximum number of points that lie on the same straight line.
Answer
/** * Definition for a point. * class Point { * int x; * int y; * Point() { x = 0; y = 0; } *
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service