Skip to content

Instantly share code, notes, and snippets.

View mustafa-qamaruddin's full-sized avatar

Mustafa Qamar-ud-Din mustafa-qamaruddin

View GitHub Profile
@mustafa-qamaruddin
mustafa-qamaruddin / pair.java
Created November 12, 2022 15:07
Pair Class Comparable for HashSet
class Solution {
private class Pair implements Comparable<Pair> {
private int a;
private int b;
public Pair(int a, int b) {
this.a = a;
this.b = b;
}
public int a() { return a;}
@mustafa-qamaruddin
mustafa-qamaruddin / 2451-odd-string-difference.java
Created November 6, 2022 19:31
[LeetCode] 2451. Odd String Difference
class Solution {
private int[] calcDiff(char[] chars) {
int[] diffs = new int[chars.length-1];
for(int i = 0; i < chars.length - 1; i++) {
diffs[i] = chars[i+1] - chars[i];
}
return diffs;
}
@mustafa-qamaruddin
mustafa-qamaruddin / PalindromePairs.Java
Created September 18, 2022 18:14
336. Palindrome Pairs (Leetcode - Hard)
class Solution {
public String reverseString(String input) {
return new StringBuffer(input).reverse().toString();
}
public boolean isPalindrome(String str) {
if (str.length() == 0) return false;
if (str.length() == 1) return true;
public class Solution {
private int popCount(int x) {
int count;
for (count = 0; x != 0; ++count) {
x &= x - 1; // zeroing out the least significant nonzero bit
}
return count;
}
@mustafa-qamaruddin
mustafa-qamaruddin / trie.java
Created May 31, 2022 18:52
Trie Data Structure - Recursive Search ( LeetCode 211. Design Add and Search Words Data Structure) https://leetcode.com/problems/design-add-and-search-words-data-structure/)
class Trie {
TrieNode root;
public Trie() {
root = new TrieNode();
}
public TrieNode getRoot() {
return root;
# create account
mutation createAccount($value:AccountInput!) {
createAccount(value:$value)
{
id
instanceId
}
}
# create account.1
mutation createAccount($value:AccountInput!) {
createAccount(value:$value)
{
id
instanceId
}
}
{
@mustafa-qamaruddin
mustafa-qamaruddin / test_case.graphql
Last active April 10, 2022 14:24
test case with access rights
# run a find on pair
# add a pair
mutation upsert($values:HypiUpsertInputUnion!) {
upsert(values:$values){
id
}
}
{
"values": {
mutation createAccount($value:AccountInput!) {
createAccount(value:$value)
{
id
instanceId
}
}
{
@mustafa-qamaruddin
mustafa-qamaruddin / tc1.graphql
Last active June 17, 2022 05:16
access account
# create some data
mutation upsert($values:HypiUpsertInputUnion!) {
upsert(values:$values){
id
}
}
{
"values": {
"Pair": {