Skip to content

Instantly share code, notes, and snippets.

View shubhampateliitm's full-sized avatar
🎯
Focusing

Shubham Patel shubhampateliitm

🎯
Focusing
View GitHub Profile
ListNode* merge(ListNode*A, ListNode*B){
ListNode * C;
ListNode * temp;
int i = 0;
while(A!=NULL && B!=NULL){
if(A->val > B->val){
if(i==0){
struct Node{
int val;
struct Node * next;
struct Node * nextMin;
Node(int v){
val = v;
next = NULL;
nextMin = NULL;
}
};
bool isfine(vector<vector<int>>& res,int x,int y, int no){
int i,j,k;
for( i = 0; i < 9 ; i++ ){
if(res[x][i]==no || res[i][y]==no){
return false;
}
@shubhampateliitm
shubhampateliitm / InterviewBit : Substring Concatenation
Created September 26, 2018 15:59
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without any intervening characters. Example : S: "barfoothefoobarman" L: ["foo", "bar"] You should return the indices: [0,9]. (order does not matter).
vector<int> Solution::findSubstring(string A, const vector<string> &B) {
// For the result.
vector<int> res;
// Calculating the no of sub-component available.
int sz = B.size();
//cout << "totalComp" << " " << sz << endl;
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@shubhampateliitm
shubhampateliitm / interviewBit_Jump_Game.cpp
Created October 8, 2018 23:21
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. For example: A = [2,3,1,1,4], return 1 ( true ). A = [3,2,1,0,4], return 0 ( false ). Return 0/1 for this problem
int Solution::canJump(vector<int> &A) {
int sz = A.size();
int lastIndex = sz-1;
int i = 0;
int reachable = A[i];
while(i<=reachable){
@shubhampateliitm
shubhampateliitm / InterviewBit :: Min Jumps Array.cpp
Last active October 8, 2018 23:43
https://www.interviewbit.com/problems/min-jumps-array/ Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to reach the last index in the minimum number of jumps. Example : Given array A = [2,3,1,1,4] Th…
int Solution::jump(vector<int> &A) {
int lastIndex = A.size()-1;
int sz = A.size();
int i = 0;
int checkUpTo = i+A[i];
int jumpCount = 1;
while(i<=checkUpTo){
import tensorflow as tf
import numpy as np
## creaing intList.
## This is a method that create IntList that feature seeks as input. value can
# take anything that is integer iterable.
# for example you can pass a set {3,4,6}, list [2,5,4], tuple (6,4,2).
# It is all good
intL = tf.train.Int64List(value=[3,4,5])
# Let see how it looks.
print(intL)