Skip to content

Instantly share code, notes, and snippets.

View SleimanJneidi's full-sized avatar

Sleiman Jneidi SleimanJneidi

View GitHub Profile
static class RangeSet extends AbstractSet<Integer> {
static class Interval {
private final int start;
private final int end;
Interval(int start, int end) {
this.start = start;
this.end = end;
}
@State(Scope.Thread)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class SomeBenchmark {
private List<String> stringList = new ArrayList<>();
@Setup
public void setup() throws Exception{
package com.codelexems;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.util.*;
import java.util.concurrent.TimeUnit;
public int lengthOfLongestSubstring(String s) {
if(s==null || s.length()==0)
return 0;
int max = Integer.MIN_VALUE;
for (int i = 0; i < s.length(); i++) {
int []charIndex = new int[127];
charIndex[s.charAt(i)]++;
int count = 1;
for (int j = i+1; j < s.length(); j++) {
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) {
* val = x;
* next = null;
* }
* }
CREATE SEQUENCE notification_id_seq;
CREATE TABLE notification
(
id integer NOT NULL DEFAULT nextval('notification_id_seq'::regclass),
channels text[],
message json,
createdts timestamp without time zone,
user_id integer,
isread boolean DEFAULT false,
/**
* Definition for singly-linked list.
* public class ListNode {
* int val;
* ListNode next;
* ListNode(int x) {
* val = x;
* next = null;
* }
* }