LeeCode,leetcodeoj題目:Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ / / / \ \ 3
LeetCode,leetcodeoj題目:A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total number of ways to decode it. For
LeetCode,leetcodeoj題目:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up: Did you use extra space?A straight forward solution using O(mn) space is probably a bad idea.A simple improvement uses O(m +
hibernate(十)雙向關聯關係的CRUD,hibernatecrud一、儲存1、假設一個group有多個user,一個user只屬於一個group,當儲存user對象到資料庫中時可以User u = new User();u.setName("u1");Group g = new Group();g.setName("g1");u.setGroup(g);Session s = sessionFactory.getCurrentSession();s.beginTransaction();
LeetCode,leetcodeoj題目:Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:a) Insert a characterb) Delete
LeetCode,leetcodeoj題目:Implement int sqrt(int x).Compute and return the square root of x.思路:二分尋找package manipulation;public class Sqrt { public int mySqrt(int x) { if (x <= 1) return x; int start = 1; int end = x / 2;