package com.fishercoder.solutions;

/**
 * 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 boolean isPerfectSquare(int num) {
		long i = 1;
		long temp = 1;
		while (temp < num) {
			i += 2;
			temp += i;
		}
		return temp == num;
	}

}

@@ -33,16 +33,48 @@
 s;%0A%0A/**%0A
+ * 367. Valid Perfect Square%0A *%0A
  * Given
@@ -341,16 +341,50 @@
 _367 %7B%0A%0A
+%09public static class Solution1 %7B%0A%09
 %09public 
@@ -420,16 +420,17 @@
 um) %7B%0A%09%09
+%09
 long i =
@@ -433,16 +433,17 @@
  i = 1;%0A
+%09
 %09%09long t
@@ -453,16 +453,17 @@
  = 1;%0A%09%09
+%09
 while (t
@@ -482,16 +482,17 @@
 %0A%09%09%09
+%09
 i += 2;%0A
 %09%09%09t
@@ -487,16 +487,17 @@
 i += 2;%0A
+%09
 %09%09%09temp 
@@ -504,18 +504,20 @@
 += i;%0A%09%09
+%09
 %7D%0A
+%09
 %09%09return
@@ -530,14 +530,17 @@
 == num;%0A
+%09
 %09%7D%0A
+%09%7D
 %0A%7D%0A

refactor 367