Skip to content

Instantly share code, notes, and snippets.

View abhinavjonnada82's full-sized avatar

ABHINAV JONNADA abhinavjonnada82

  • Washington, DC
View GitHub Profile
@abhinavjonnada82
abhinavjonnada82 / leetcode-bloomberg.md
Created November 23, 2022 17:50 — forked from jayant91089/leetcode-bloomberg.md
Answers to leetcode questions tagged 'Bloomberg'

121 Best Time to Buy and Sell Stock

Say you have an array for which the ith element is the price of a given stock on day i.

If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit.

Example 1: Input: [7, 1, 5, 3, 6, 4] Output: 5

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Email Template</title>
</head>
<body style="margin:0;background-color:#cccccc;">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Email Template</title>
</head>
<body style="margin:0;background-color:#cccccc;">
@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