Skip to content

Commit 83a4979

Browse files
committed
Added more solutions
1 parent 3be782f commit 83a4979

File tree

6 files changed

+89
-4
lines changed

6 files changed

+89
-4
lines changed

LeetCodeSolutions/EasyLevelSolutions/.classpath

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<attribute name="maven.pomderived" value="true"/>
1313
</attributes>
1414
</classpathentry>
15-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
15+
<classpathentry kind="src" path="src/main/resources"/>
16+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
1617
<attributes>
1718
<attribute name="maven.pomderived" value="true"/>
1819
</attributes>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
eclipse.preferences.version=1
22
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3-
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
4-
org.eclipse.jdt.core.compiler.compliance=1.5
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.compliance=1.8
55
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
66
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
77
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
8-
org.eclipse.jdt.core.compiler.source=1.5
8+
org.eclipse.jdt.core.compiler.source=1.8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
*
3+
*/
4+
package com.javaaid.solutions.easy.arrays;
5+
6+
/**
7+
* @author Kanahaiya Gupta
8+
*
9+
*/
10+
public class FindAnagramMappings {
11+
public int[] anagramMappings(int[] A, int[] B) {
12+
int len = A.length;
13+
int a[] = new int[len];
14+
for (int i = 0; i < len; i++) {
15+
for (int j = 0; j < len; j++) {
16+
if (A[i] == B[j]) {
17+
a[i] = j;
18+
}
19+
}
20+
}
21+
return a;
22+
}
23+
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
*
3+
*/
4+
package com.javaaid.solutions.easy.arrays;
5+
6+
/**
7+
* @author Kanahaiya Gupta
8+
*
9+
*/
10+
public class HammingDistance {
11+
public int hammingDistance(int x, int y) {
12+
int xor = x ^ y;
13+
return countNoOf1s(xor);
14+
15+
}
16+
17+
private int countNoOf1s(int n) {
18+
int count = 0;
19+
while (n != 0) {
20+
n = n & (n - 1);
21+
count++;
22+
}
23+
24+
return count;
25+
}
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
*
3+
*/
4+
package com.javaaid.solutions.easy.arrays;
5+
6+
/**
7+
* @author Kanahaiya Gupta
8+
*
9+
*/
10+
public class JudgeRouteCircle {
11+
public boolean judgeCircle(String moves) {
12+
int n = moves.length();
13+
int x = 0, y = 0;
14+
for (int k = 0; k < n; k++) {
15+
char ch = moves.charAt(k);
16+
if (ch == 'L') {
17+
x--;
18+
} else if (ch == 'R') {
19+
x++;
20+
} else if (ch == 'U') {
21+
y++;
22+
} else if (ch == 'D') {
23+
y--;
24+
}
25+
26+
}
27+
return x == 0 && y == 0;
28+
29+
}
30+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Write your MySQL query statement below
2+
SELECT NAME, POPULATION, AREA
3+
FROM WORLD
4+
WHERE AREA>3000000 OR POPULATION >25000000

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy