package com.fishercoder.solutions;

/**
 * 367. Valid Perfect Square
 *
 * Given a positive integer num, write a function which returns True if num is a perfect square else False.

 Note: Do not use any built-in library function such as sqrt.

 Example 1:

 Input: 16
 Returns: True
 Example 2:

 Input: 14
 Returns: False
 */
public class _367 {

	public static class Solution1 {
		public boolean isPerfectSquare(int num) {
			long i = 1;
			long temp = 1;
			while (temp < num) {
				i += 2;
				temp += i;
			}
			return temp == num;
		}
	}
}

@@ -33,299 +33,8 @@
 s;%0A%0A
-/**%0A * 367. Valid Perfect Square%0A *%0A * Given a positive integer num, write a function which returns True if num is a perfect square else False.%0A%0A Note: Do not use any built-in library function such as sqrt.%0A%0A Example 1:%0A%0A Input: 16%0A Returns: True%0A Example 2:%0A%0A Input: 14%0A Returns: False%0A */%0A
 publ
@@ -50,17 +50,20 @@
 _367 %7B%0A%0A
-%09
+    
 public s
@@ -86,18 +86,24 @@
 tion1 %7B%0A
-%09%09
+        
 public b
@@ -140,26 +140,44 @@
 ) %7B%0A
-%09%09%09long i = 1;%0A%09%09%09
+            long i = 1;%0A            
 long
@@ -187,19 +187,28 @@
 mp = 1;%0A
-%09%09%09
+            
 while (t
@@ -224,43 +224,85 @@
 ) %7B%0A
-%09%09%09%09i += 2;%0A%09%09%09%09temp += i;%0A%09%09%09%7D%0A%09%09%09
+                i += 2;%0A                temp += i;%0A            %7D%0A            
 retu
@@ -321,13 +321,22 @@
 um;%0A
-%09%09%7D%0A%09
+        %7D%0A    
 %7D%0A%7D%0A

refactor 367