Skip to content

Instantly share code, notes, and snippets.

View Cvetomird91's full-sized avatar

Cvetomir Denchev Cvetomird91

  • Plovdiv, Bulgaria
View GitHub Profile
const limit = 100;
const sizing = 5000;
let visited = [];
let left = [];
let right = [];
let L = [[]];
let G = [[]];
let id = [[]];
const dr = [-1, 1, 0, 0];
const dc = [0, 0, -1, 1];
const nums = [7, 8, 6, 5];
binaryArray = nums.map((element) => {var decimal = Number(element).toString(2); return (decimal.length == 4 ? decimal : "0" + decimal);})
.sort((left, right) => {
var leftDigitCount = (left.match(/1/g) || []).length;
var rightDigitCount = (right.match(/1/g) || []).length;
return (leftDigitCount == rightDigitCount ? parseInt(left, 2) - parseInt(right, 2) : (leftDigitCount > rightDigitCount) ? 1 : -1)
});
const http = require("https");
const options = {
"method": "GET",
"hostname": "rapidapi.p.rapidapi.com",
"port": null,
// "path": "/forecast/daily?q=san%20francisco%2Cus&lat=35&lon=139&cnt=16",
"path": "/forecast/daily?q=london%2Cuk&lat=35&lon=139&cnt=16",
"headers": {
"x-rapidapi-host": "community-open-weather-map.p.rapidapi.com",
package org.pu.javapp.model;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
import java.io.File;
import java.util.stream.Collectors;
CREATE DATABASE TV;
use TV;
--1
CREATE TABLE TV_CHANNELS
(
TV_NO char(3) not null primary key,
NAME VARCHAR(20) not null
)
CREATE TABLE INVOICES
(
INV_NO char(10) not null,
INV_DATE DATE not null,
constraint PK_INVOICES primary key (INV_NO)
)
CREATE TABLE PRODUCTS
(
PRODUCT_ID int not null,
SELECT * FROM CUSTOMERS, ORDERS, ORDER_ITEMS
WHERE CUSTOMERS.CUSTOMER_ID = ORDERS.CUSTOMER_ID and ORDERS.ORDER_ID = ORDER_ITEMS.ORDER_ID;
SELECT CUSTOMERS.FNAME, CUSTOMERS.LNAME, count(distinct ORDERS.ORDER_ID) Orders, sum(ORDER_ITEMS.UNIT_PRICE * ORDER_ITEMS.QUANTITY) FROM CUSTOMERS, ORDERS, ORDER_ITEMS
WHERE CUSTOMERS.CUSTOMER_ID = ORDERS.CUSTOMER_ID and ORDERS.ORDER_ID = ORDER_ITEMS.ORDER_ID group by CUSTOMERS.FNAME, CUSTOMERS.LNAME order by 4 desc;
create database PCT;
use PCT;
create table REGIONS
(
REGION_ID smallint not null,
NAME varchar(25) not null,
constraint PK_REGIONS primary key (REGION_ID)
)
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--Created with JFLAP 7.1.--><structure>
<type>fa</type>
<automaton>
<!--The list of states.-->
<state id="0" name="q0">
<x>51.0</x>
<y>120.0</y>
<initial/>
</state>
<state id="1" name="q1">
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {
//register custom formatters and converters
@Override
public void addFormatters(FormatterRegistry registry) {
// ...
}
//customize global Validator instance