problem-solving ideas: such as solution, Time complexity O (n) Java source code (spents 373ms):public class Solution {public int maxarea (int[] height) { int max=-1,l=0,r=height.length-1; while (lC Language Source code (spents 12ms):int Maxarea (int* height, int heightsize) { int max=-1,area,l=0,r=heightsize-1,k; while (lC + + source code (spents 30ms):Class Solution {public: int Maxarea (vectorPython source code (spents 152
findsubstring ( Self, S, words): Lens=len (s); Lenw=len (Words[0]); Length=len (words) map={};res=[] for i in range (length): if words[i] in map:map[words[i]]+=1 else:map[words[i]]=1 if not words[i] in S:return res for I in range (lens-lenw*length+1): tmp={};j=0;flag=true for J in range (length): pos=i+j*lenw Sub=s[pos:pos +LENW] if sub in map: num=0
Problem:Write a function to find the longest common prefix string amongst an array of strings.Solution:time complexity O (n)Main topic:give a string array to find the maximum prefix common substring of these strings. Problem Solving Ideas:since it is a common substring, that each string must contain, and in the head, first the first string as the default maximum, and then followed by each string in contrast, calculate all the maximum matching length, the smallest is the lengthJava source code (s
Solvesudoku (vectorPython source code (636MS):Class Solution: # @param {character[][]} board # @return {void} do not return anything, modify board In-place Instea D. def solvesudoku (self, Board): self. SudoKu (board,0,0) def SudoKu (self,board,i,j): If I==8 and J==9:return True if j==9:i+=1;j=0 if boa Rd[i][j]!= '. ': if self. SudoKu (board,i,j+1): Return True Else:map=self.getvalidnum (board,i,j) for K in range (1,10): If MAP[K]==0:BOARD[I][J]=CHR (K+ord (' 0 ')) if self.
-point method to determine the position of the elements, the exact sort of the back when there is no need for a great move, so to achieve high efficiency.
For example: for a[] ={63, 4, 24, 1, 3, 15}, first we use the start step steps =length/2=3 each element in the array, and so on, exchange, that is to say, a[0] compared to a[0+step=3, a[0]>a[3] swap position, A [0]=1,a[3]=63 (in this case, 1 jumped to the first place), and then proceed to the next group of comparison A[1]>a[4] (subscript are d
Atitit. GUI picture non-rule button and dynamic picture switch Implementation Mode Summary java. NET C # C + + web HTML JS1. Summary of the effect of the Picture button 11.1. Button picture is automatically scaled. 11.2. Do not frame, if you use a custom picture to make a button background can be set to false. 21.3. Shaped Button 21.4. Do not draw focus 21.5. Ico
In recent days, I have seen many questions about communication between C/C ++ and Java on csdn, especially the data structures (such as struct) Unique to C ).
I would like to give an example based on a netizen's question, hoping to help beginners.
Original problem see: http://community.csdn.net/Expert/topic/3886/388698
C # to Java, install JDK on Linux Ubutu, and run Java programsThen choose Java, naturally the self-written program to be able to run on each OS,Here are the installation tutorials, which are installed online via the network, and then several commands are lost, and it's easy toI test effectiveInstall Oracle Java8 under
There is a Boolean data type in Java, True is true and False is false. Also, only Boolean values can be placed in the if () brackets.C's basic data types are basically consistent with Java, but C has more pointer types. Pointers are the focus of the C language.It is important to note that
Because C + + and Java have a lot of similarities, and there are a lot of subtle differences, so in the process of learning Java in the two languages to compare learning.1. Exception mechanism of C + +The process of handling exceptions in C + + is this: in the execution of t
the same place:1, syntax similar: because Java can be considered from C + + development, so Java and C language syntax comparison is similar2. Proficiency in programming is the mastery of the Language program library:to some extent, the programming language is composed of syntax and corresponding library,
When it comes to threading, Java threads are now only known to inherit from thread, start the thread with the start function, and later learn more about Java threading, which is added to this chapter.C + + threads have been used many times during the reading, the following first summarizes:1. C + + threading(1) MFC multithreadingI didn't use it this way, so here'
RSA Signature java/php/c# Version and Java verification implementation
???? in the open platform area, the SDK needs to be provided to the ISV, and signing is one of the features that need to be provided in the SDK. Because the development language used by ISVs is not single, the SDK needs to be available in multiple languages. such as
=2147483647; Private final static int int_min=-2147483648; public int myatoi (String str) {char[] chs = Str.tochararray (); int index=0; while (IndexC Language Source code (spents 5ms):int Myatoi (char* str) { int flag=1,res=0,dig; while (*str== ') str++; if (*str== '-') { flag=-1; str++; } else if (*str== ' + ') { str++; } while (*STR) { if (*strC + + source code (spents 17ms):Class Solution {public: int myatoi (string str
functions such as the keyword starting with S. It is easy to set the value of auto activation triggers for Java, and change the original trigger "." To "." + 26 × 2 letters. Hmm? Why is it 26 × 2? Because the letters are case-sensitive, 26 in upper case and 26 in lower case. Of course 26 × 2 is the case!
The procedure is as follows:
Go to: Windows → preferences → Java → editor → content assist
Then mo
C ++, C #, java Algorithm learning diary 01 --- BubbleSort)
Life is a process of continuous learning and perfection.C # Learning DiaryLet's get to an end (not to end ^_^). Now, let's start a new journey. Learn about algorithms!
When I learned C, I came into contact with the first algorithm in my life, BubbleSort ).
As
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.