This file contains hidden or 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
| /** | |
| // work with jboss-eap-6.1 | |
| <dependency> | |
| <groupId>com.auth0</groupId> | |
| <artifactId>java-jwt</artifactId> | |
| <version>2.3.0</version> | |
| </dependency> | |
| */ | |
| import com.auth0.jwt.JWTSigner; |
This file contains hidden or 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
| public class ResponseMap<K, V> extends HashMap<K, V> { | |
| private ResponseMap() { | |
| } | |
| public static <K, V> ResponseMap<K, V> of(K k1, V v1) { | |
| ResponseMap<K, V> map = new ResponseMap<K, V>(); | |
| map.put(k1, v1); | |
| return map; |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| # run from the base dir of the maven webapp | |
| # you need to modify the following file in <tomcat_home>/conf/context.xml do: | |
| # | |
| #<Context reloadable="true"> | |
| # <Resources allowLinking="true"> </Resources> | |
| TOMCAT_HOME=/home/mhewedy/programs/apache-tomcat-8.5.23 |
This file contains hidden or 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
| package com.example.dateargsresolver; | |
| import org.springframework.core.MethodParameter; | |
| import org.springframework.web.context.request.NativeWebRequest; | |
| import org.springframework.web.method.annotation.RequestParamMethodArgumentResolver; | |
| import java.time.LocalDate; | |
| import java.time.format.DateTimeFormatter; | |
| /** |
This file contains hidden or 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
| import java.util.ArrayDeque; | |
| import java.util.Deque; | |
| public class BracketsBalanceChecker { | |
| public static void main(String[] args) { | |
| System.out.println(isBalanced("[()]{}{[()()]()}")); | |
| System.out.println(isBalanced("[(])")); |
This file contains hidden or 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
| private static int gap(int N) { | |
| int max = 0; | |
| int counter = -1; | |
| while (N != 0) { | |
| if ((N & 1) == 1) { | |
| if (counter > max) { |
This file contains hidden or 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
| public class TreeHeight { | |
| static class Node { | |
| char data; | |
| Node left, right; | |
| Node(char data) { | |
| this.data = data; | |
| } |
This file contains hidden or 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
| public class LowestCommonAncestor { | |
| static class Node { | |
| int data; | |
| Node left, right; | |
| Node(int data) { | |
| this.data = data; | |
| } |
This file contains hidden or 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
| import java.util.Arrays; | |
| public class CyclicRotation { | |
| public static void main(String[] args) { | |
| System.out.println(Arrays.toString(shiftBy(new int[]{3, 8, 9, 7, 6}, 3))); | |
| } | |
| private static int[] shiftBy(int[] A, int K) { | |
This file contains hidden or 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
| import java.util.HashMap; | |
| import java.util.Map; | |
| public class OddOccurrencesInArray { | |
| public static void main(String[] args) { | |
| System.out.println(new OddOccurrencesInArray().solution(new int[]{9, 3, 9, 3, 9, 9, 7})); | |
| } |