-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package demo1; | ||
|
||
public class Parenthesis { | ||
public boolean chkParenthesis(String A, int n) { | ||
// write code here | ||
if (n % 2 == 1){ | ||
return false; | ||
}else { | ||
char[] array = A.toCharArray(); | ||
for (int i = 0; i < array.length; i++) { | ||
if (array[i] == '(' || array[i] == ')'){ | ||
continue; | ||
}else { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} | ||
} | ||
|
||
public class Brackets { | ||
public static void main(String[] args) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package demo1; | ||
|
||
import java.util.Scanner; | ||
|
||
public class Fibonacci { | ||
public static void main(String[] args) { | ||
Scanner sc = new Scanner(System.in); | ||
int m = sc.nextInt(); | ||
int n = 0; | ||
int f1 = 0, f2 = 1, f3 = 0; | ||
while (f3 < m){ | ||
f3 = f1 + f2; | ||
f1 = f2; | ||
f2 = f3; | ||
} | ||
if (m - f1 > f2 - m){ | ||
System.out.println(f2-m); | ||
}else { | ||
System.out.println(m-f1); | ||
} | ||
} | ||
} |