Skip to content

Instantly share code, notes, and snippets.

View abhinavjonnada82's full-sized avatar

ABHINAV JONNADA abhinavjonnada82

View GitHub Profile
@abhinavjonnada82
abhinavjonnada82 / README.md
Created May 6, 2021 21:00 — forked from joyrexus/README.md
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@abhinavjonnada82
abhinavjonnada82 / gist:27666052d010f8a6508e10433d50005b
Created February 4, 2021 16:35 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
class Solution {
HashMap<Character, Character> mappings;
public Solution() {
this.mappings = new HashMap<Character, Character>();
this.mappings.put(')', '(');
this.mappings.put('}', '{');
this.mappings.put(']', '[');
}
/*Is palindorme*/
public boolean isPalindrome(String s) {
char[] = s.toCharArray();
for (int i = 0, j = c.length - 1; i< j;) {
if (!Character.isLetterOrDigit(c[i])) i++;
else if (!Character.isLetterOrDigit(c[i])) j--;
else if(Character.toLowerCase(c[i++]) != Character.toLowerCase(c[j--]))
return false;
}
/*
place two pointers at i = 0 & j = arr.length-1 while i < j
calculate prod & compare max , if arr[start] > arr[end]
end -= 1 else start += 1
O(N) runtime
O(1) space
*/
public int containerMostWater(int[] arr) {
if arr.length < 2
return -1;
public int factorial(int n) {
if (n == 0)
return 1;
else
return n * factorial(n-1);
}
public int rangeSum(int[] array, int start, int end) {
if (start > end)
return 0;
/*
Linked list stores a single instance variable that is a pointer to the first Node in the list
Insert into a Linked List:
Step 1: Create new node
Step 2: Set next to current head
Step 3: Set the new node to be the head
Remove from a Linked List:
Step 1: Set the pointer from head to the next node in the list
// Design a HashMap
// Initialise a node with privat key & value &
// Set the node constructor
class Node {
private int key;
private int value;
Node(int key, int value){
'''
om vnr
Arrays & Strings
1.)
Add a series of number from 1 through n. Sums all the numbers from
1 through that integer(both inclusive). Don't include numbers that
are divisble by 5 or 7
'''
Implement stack using queues:
Queue data structures supports enqueue() & dequeue() [First in, first out]
Stack data structures supports push() & pop() [Last in, first out]
In this, the newly entered element is always at the front of 'q1', so that
pop operation just dequeues from 'q1'. 'q2' is used to put every new element
at front of 'q1'
Stack(s) can be implemented using two queues (q1 & q2). Following operation