Skip to content

Instantly share code, notes, and snippets.

View KoichiSugi's full-sized avatar
😰

KoichiSugi

😰
View GitHub Profile
class Solution {
public ListNode reverseList(ListNode head) {
ListNode prev = null;
ListNode current = head;
ListNode next = null;
while(current != null){
next = current.next;
current.next = prev;
public class Solution {
public boolean hasCycle(ListNode head) {
//Using Hashset because items in hashset must be unique
HashSet<ListNode> hashSet = new HashSet<ListNode>();
while(head != null){
if(hashSet.contains(head))
return true;
//when seeing the node for the first time, insert it in hashset
hashSet.add(head);
class Solution {
public boolean isPalindrome(int x) {
if(x<0){return false;}
String str = String.valueOf(x);
int length = str.length();
for(int i = 0; i < length / 2; i++){
if (str.charAt(i) != str.charAt(length- i - 1))
return false;
@KoichiSugi
KoichiSugi / AnagramChecker.java
Last active July 21, 2021 01:16
Checking Anagram from A list of String
import java.util.*;
public class AnagramChecker {
public static void main(String[] args) {
List<String> wordList = new ArrayList<>();
wordList.add("cat");
wordList.add("is");
wordList.add("in");
package flag;
public class main {
public static void main(String args[]) {
String[] lines = {"RU", "WU", "WD"};
Boolean redflag = true;//true = down
Boolean whiteflag = true;
npm i --save @fortawesome/fontawesome-svg-core
npm install --save @fortawesome/free-solid-svg-icons
npm install --save @fortawesome/react-fontawesome