Category Archives: منوعات
Brain Wars
Brain Wars
Brain Wars
I challenged Ken Lam and won:) Challenge players from around the world! #BrainWars
http://brainwarsapp.com/
solve rtl in Arabic in any web page
دروس من الحياة
Java Primality Test
import java.util.*;
import java.math.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
BigInteger n = in.nextBigInteger();
in.close();
if (!n.equals(new BigInteger("1")) && n.isProbablePrime(1))
System.out.println("prime");
else
System.out.println("not prime");
}
}
Android / Iphone disk clean up
I saved 500MB on my phone using Files Go! Can you save more? Try the app at g.co/filesgo. #filesgo
693. Binary Number with Alternating Bits
693. Binary Number with Alternating Bits
class Solution {
public boolean hasAlternatingBits(int n) {
String binary = Integer.toBinaryString(n);
for (int i = 1; i < binary.length(); i++) {
if (binary.charAt(i) == binary.charAt(i - 1))
return false;
}
return true;
}
}
Brain wars
Awesome app for brain games:
https://play.google.com/store/apps/details?id=jp.co.translimit.brainwars