For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].
NOTE:
Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem.
A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers.
Examble:19 is a happy number
For Example:
Given"25525511135"
return ["255.255.11.135", "255.255.111.35"]. (Order does not matter)
For Examble:
A= [2,3,1,1,4],returntrue
A= [3,2,1,0,4], return false
What is the minimum candies you must give?
=>true=>true=>false=>false=>truewords:: ["This", "is", "an", "example", "of", "text", "justification."]
L: 16.
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype should be:
bool isMatch(const char *s, const char *p)
Some examples:
a. isMatch("aa","a") → false
b. isMatch("aa","aa") → true
c. isMatch("aaa","aa") → false
d. isMatch("aa", "a*") → true
e. isMatch("aa", ".*") → true
f. isMatch("ab", ".*") → true
g. isMatch("aab", "c*a*b") → true
pairStar("hello") → "hel*lo"
pairStar("xxyy") → "x*xy*y"
pairStar("aaaa") → "a*a*a*a"
Note:
[ [2], [1], [1,2,2], [2,2], [1,2], [] ]
There are some rules to a Roman number:
There are some rules to a Roman number:
In other words, two singly linked-lists meet at some point, find the node at which they meet.
Examples: