This is a game based on classic Minesweeper but not just that. It's a perfect reproduction of classic Windows Minesweeper game on Android. Have fun!
Click To Download On Amazon Appstore
Project site
Friday, August 26, 2016
Android Studio Project: Classic 2048 Game Updated
The new version of 2048 adds back button to make this game more flexible, and adds exit prompt to prevent muffed exits effectively. In the meantime, the problem of too many cards on some devices has been repaired.
Click To Download On Amazon Appstore
Project site are in my previous post: Android Project: Classic 2048 Game.
Click To Download On Amazon Appstore
Project site are in my previous post: Android Project: Classic 2048 Game.
Tuesday, August 23, 2016
Android Learning Note: Being Cautious To Use static Modifier When Defining A Variable
Using static modifier when defining a variable in a class means it's a class variable, which has only 1 identical value in different instance objects.
Saturday, August 20, 2016
LeetCode Online Judge-5. Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.
//Java Program: Longest Palindromic Substring
public class Solution {
public String longestPalindrome(String s) {
//In this program, there is no empty string acturally.
if (s.length()==0) {
return null;
}
String result = s.substring(0, 1);
//Axis of symmetry: i/2.0
for(int i=1,j;i<2*s.length()-2&&(s.length()-1-i/2)*2+1>result.length();++i) {
for(j=0;(i-1)/2-j>=0&&i/2+1+j<s.length();++j) {
if (s.charAt((i-1)/2-j)!=s.charAt(i/2+1+j)) {
break;
}
}
String temp = s.substring((i-1)/2-j+1, i/2+1+j);
if (temp.length()>result.length()) {
result = temp;
}
}
return result;
}
}
//Java Program: Longest Palindromic Substring
public class Solution {
public String longestPalindrome(String s) {
//In this program, there is no empty string acturally.
if (s.length()==0) {
return null;
}
String result = s.substring(0, 1);
//Axis of symmetry: i/2.0
for(int i=1,j;i<2*s.length()-2&&(s.length()-1-i/2)*2+1>result.length();++i) {
for(j=0;(i-1)/2-j>=0&&i/2+1+j<s.length();++j) {
if (s.charAt((i-1)/2-j)!=s.charAt(i/2+1+j)) {
break;
}
}
String temp = s.substring((i-1)/2-j+1, i/2+1+j);
if (temp.length()>result.length()) {
result = temp;
}
}
return result;
}
}
Subscribe to:
Posts (Atom)