Skip to content

Instantly share code, notes, and snippets.

@a3nv
a3nv / E53MaximumSubArray.java
Last active June 21, 2021 18:17
53. Maximum Subarray; 152. Maximum Product Subarray
public class E53MaximumSubArray {
public int optimizedBruteForce(int[] nums) {
var max = Integer.MIN_VALUE;
for (var i = 0; i < nums.length; i++) {
var current = 0;
for (var j = i; j < nums.length; j++) {
current += nums[j];
max = Math.max(max, current);
}
@a3nv
a3nv / M238ProductOfArrayExceptSelf.java
Created June 15, 2021 21:47
238. Product of Array Except Self
/**
* 238. Product of Array Except Self
* @author Ivan Asonov
* * Date: June 13, 2021
* * @see <a href="https://leetcode.com/problems/product-of-array-except-self/">238. Product of Array Except Self</a>
*/
public class M238ProductOfArrayExceptSelf {
public int[] productExceptSelf(int[] nums) {
var result = new int[nums.length];
@a3nv
a3nv / .vimrc
Last active March 4, 2020 14:29
syntax on
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

common mongo commands

command description
mongo connect to the mongo database
use 'db_name' connect to a particular database
db.auth('admin_name', 'password') authorize to interact with a particular database

mongo commands to manipulate with data

|command |example |description |

work with branches

command description
git branch | grep 'part_of_branch_name' | xargs git branch -D remove a bunch of git branches
@a3nv
a3nv / useful_linux_commands.md
Last active July 13, 2018 06:32
useful_linux_commands.md

linux packages

command description
sudo apt-get purge --auto-remove packagename remove specified package
sudo dpkg --get-selections list of all installed packages
sudo dpkg --get-selections | grep packagename find all packages which contains specified string in its name

port usage

|command |description |

@a3nv
a3nv / AbstractFacade.java
Created March 8, 2016 19:38 — forked from Snugglepantz/AbstractFacade.java
Modified Netbeans Abstract Facade
package me.slashfix.angular.rest;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.Query;
/**