Skip to content

Instantly share code, notes, and snippets.

@AkshayMathur92
AkshayMathur92 / WebClient2.java
Created November 19, 2019 05:59
Demo Class for JerseyClient Memory Leak
@Singleton
public class WebClient {
private final Client client;
@Inject
public WebClient(Client client) {
this.client = client;
}
public Object call(String url){
@AkshayMathur92
AkshayMathur92 / WebClient.java
Last active November 19, 2019 05:53
WebClient
/**
* @author : akshay.mathur
**/
@Singleton
public class WebClient {
private final Client client;
@Inject
public WebClient(Client client) {
this.client = client;
@AkshayMathur92
AkshayMathur92 / MyVector.cpp
Last active May 4, 2019 13:37
Implementation of Vector
#include <iostream>
#include <string>
#include <exception>
#include <stdexcept>
#include <iterator>
#include <algorithm>
#include <memory>
template <typename T> class Vector {
@AkshayMathur92
AkshayMathur92 / MyArray.cpp
Last active April 25, 2019 05:10
Array Implementation in C++
/******************************************************************************
Array Implementation and Analysis
*******************************************************************************/
#include <memory>
#include <iostream>
template<typename T, size_t C>
class Array
@AkshayMathur92
AkshayMathur92 / Next Permutation.java
Created August 26, 2016 10:21 — forked from guolinaileen/Next Permutation.java
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). The replacement must be in-place, do not allocate extra memory. Here are some examples. Inputs are in the left…
public class Solution {
public void nextPermutation(int[] num) {
if(num.length==0) return;
int length=num.length;
int end=length-1;
int i=end-1;
for(; i>=0; i--)
{
if(num[i]>=num[i+1]) continue; //get an increasing set from the end
int j=end;