Skip to content

Instantly share code, notes, and snippets.

// 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 14:10
Binary Search Tree implementation in C++
#include <iostream>
using namespace std;
class BST
{
public:
int data;
BST *left, *right;
void insert(BST *, int);
void preorder(BST *);