Skip to content

Instantly share code, notes, and snippets.

Avatar
👋

Rohit Sanjay rohitsanj

👋
View GitHub Profile
View NumberOfSubmatricesThatSumToTarget.cpp
// https://leetcode.com/problems/number-of-submatrices-that-sum-to-target/
class Solution {
public:
int numSubmatrixSumTarget(vector<vector<int>>& matrix, int target) {
int r = matrix.size(), c = matrix[0].size();
vector<vector<int>> pref(matrix.size() + 1, vector<int> (matrix[0].size() + 1, 0));
for(int i = 1; i < r + 1; i++)
{
for(int j = 1; j < c + 1; j++)
@rohitsanj
rohitsanj / BST.cpp
Last active May 19, 2020
Binary Search Tree implementation in C++
View BST.cpp
#include <iostream>
using namespace std;
class BST
{
public:
int data;
BST *left, *right;
void insert(BST *, int);
void preorder(BST *);
You can’t perform that action at this time.