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
{
find(type: Account, arcql: "*") {
edges {
node {
... on Account {
username
password {
value
}
emails {
@mustafa-qamaruddin
mustafa-qamaruddin / dynamic_programming.java
Created December 14, 2021 15:55
LeetCode 198. House Robber
class Solution {
public int rob(int[] nums) {
if(nums.length==0) return 0;
if(nums.length==1) return nums[0];
int[] dp = new int[nums.length];
dp[0] = nums[0];
dp[1] = Math.max(nums[0], nums[1]);
for(int i = 2; i < nums.length; i++) {
dp[i] = Math.max(dp[i-1], nums[i]+dp[i-2]);
}
class Solution {
int[][] mem;
int dp(List<List<Integer>> arr, int level, int idx) {
if(level<0) return 0;
if(mem[level][idx]!=-999999) {
return mem[level][idx];
}
int ret = Integer.MAX_VALUE;
if (idx == arr.get(level).size()) {
@mustafa-qamaruddin
mustafa-qamaruddin / soln.java
Last active December 11, 2021 10:40
[LeetCode] 01-Matrix
class Solution {
public int[][] updateMatrix(int[][] mat) {
int m = mat.length;
int n = mat[0].length;
int[][] out = new int[m][n];
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
if(mat[i][j] == 0) {
out[i][j] = 0;
mstafa@mstafa-Inspiron-3537:~$ wsk action -i invoke /whisk.system/listVenues -p longitude -122.406417 -p latitude 37.785834 -p types night_club --result
{
"error": "The action did not produce a valid JSON response: [{\"name\":\"San Francisco\",\"photos\":[{\"height\":2268,\"html_attributions\":[\"<a href=\\\"https://maps.google.com/maps/contrib/111865529051261229115\\\">Aylof</a>\"],\"photo_reference\":\"Aap_uEDFTBhdW6kYQxrbBVpHijgvNtMmQVGK8qqx59xr89KmzVQN5A2Vb65pug75zWZP8UVmWJ27bWw2w5O-GrjVIVu4ft35yoikrt4QGySdv9c-LIzHwBjutUFHqFmhKKe6TfOCS5kvDgwbdfdQEqTz8WpnRhCV1lDGrpDJ1duvID3L19Jv\",\"width\":4032}],\"placeID\":\"ChIJIQBpAG2ahYAR_6128GcTUEo\",\"location\":{\"lat\":37.7749295,\"lng\":-122.4194155}},{\"name\":\"The Clift Royal Sonesta Hotel\",\"photos\":[{\"height\":3456,\"html_attributions\":[\"<a href=\\\"https://maps.google.com/maps/contrib/114649630923866463683\\\">Zachary Green</a>\"],\"photo_reference\":\"Aap_uEBBvL6lk0fvDk-vMSHI9RieW1n1bBlQ8hwIInaCu7id9Z_aYMnm7RVTFupld-y99UeXDdAG_9mTpJcfCUB0JU7l-XbS
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
import java.util.List;
import java.util.Stack;
class Traverse {
int[][] graph;
boolean[] visited;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.Stack;
class Traverse {
int[][] graph;
boolean[] visited;
List<List<Integer>> retPaths;
{
"took": 109,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
{
"took": 3,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
{
"took": 32,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {