Skip to content

Instantly share code, notes, and snippets.

View itssomething's full-sized avatar
🎶
BLACK PINK IN YOUR AREA

Manh itssomething

🎶
BLACK PINK IN YOUR AREA
  • Hanoi, Vietnam
View GitHub Profile
# @param {String[]} strs
# @return {String}
def longest_common_prefix(strs)
strs = strs.sort
first = strs[0]
last = strs[strs.length - 1]
string = ""
first.length.times do |index|
if first[index] == last[index]
# @param {String[]} strs
# @return {String}
def longest_common_prefix(strs)
return "" if strs.length == 0
return strs[0] if strs.length == 1
min_length = strs[0].length
strs.each do |str|
min_length = [min_length, str.length].min
end
@itssomething
itssomething / priorityQueue.js
Created September 5, 2023 18:01
priority queue
class Node {
constructor(val, priority) {
this.val = val
this.priority = priority
}
}
class PriorityQueue {
constructor() {
this.data = []
{
"data_name": "nghiep",
"data_version": "1.0",
"emoticons": [
{
"key": "(suynghi)",
"src": "https://i.imgur.com/L9r2Wek.png"
},
{
"key": "(meohaha)",
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:padding="10dp"
android:orientation="vertical"
tools:context=".MainActivity">
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import javax.swing.BoxLayout;
import javax.swing.JButton;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package luyentap2;
import java.util.Arrays;
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
import java.util.Scanner;
/**
sudo docker-compose build
db uses an image, skipping
Building web
Step 1/13 : FROM ruby:2.6-alpine
---> 6ddb199f039f
Step 2/13 : RUN apk update -qq && apk add nodejs postgresql-client gcc make ruby-dev
---> Running in fc796ed75f6a
(1/21) Installing binutils (2.32-r0)
(2/21) Installing isl (0.18-r0)
(3/21) Installing libgomp (8.3.0-r0)
<%= @questions.each.with_index(1) do |q, index| %>
<div><strong><%= index %>. &nbsp<%= q.name %></strong></div>
<%#= question.answers.each do |answer| %>
<div><%#= answer.content %></div>
<%# end %>
<%= fields_for q do |ff| %>
<div class="answers-list">
<% if q.is_multi? %>
<%= q.answers.each do |a| %>
<div>