Regular expression is a group of characters or symbols which is used to find a specific pattern from a text.
A regular expression is a pattern that is matched against a subject string from left to right. The word "Regular expression" is a
#include <stdio.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
#define MAX_DATA 512 | |
#define MAX_ROWS 100 | |
struct Address { |
Думаю, очень круто было бы в начале предупредить, что знание тонкостей языка не так важно, | |
как умение размышлять и делать разумные предположения | |
1. Immutable strings | |
String a = "hello "; | |
String b = a; | |
a = a + "world!"; | |
System.out.println(b); |
/* | |
Given the array of IDs, which contains many duplicate integers | |
and one unique integer, find the unique integer. | |
*/ | |
// O(n^2): loop in loop | |
function find_unique_brute (array) { | |
var result = null, n = array.length; |
const timeout = (ms) => new Promise(resolve => setTimeout(resolve, ms)) | |
function getJob(ms, id) { | |
return async function () { | |
return job(ms, id) | |
} | |
} | |
async function job(ms, id) { | |
await timeout(ms) |
upstream zen_zen-front_production_splitter { | |
keepalive 2; | |
server [2a02:06b8:0c00:3b10:0000:1452:7fb3:1e24]:80 max_fails=0 fail_timeout=60 weight=1; | |
server [2a02:06b8:0c08:f427:0000:1452:005d:5634]:80 max_fails=0 fail_timeout=60 weight=1; | |
check interval=5000 rise=2 fall=3 timeout=2000 default_down=false type=http; | |
check_http_send "GET /ok.html HTTP/1.0\r\n\r\n"; | |
check_http_expect_alive http_2xx; | |
} | |
match statusok { |
/** | |
* Write a function that takes an array of integers | |
and returns that array rotated by N positions. | |
For example, if N=2, given the input array [1, 2, 3, 4, 5, 6] | |
the function should return [5, 6, 1, 2, 3, 4] | |
*/ | |
var rotate = function (arr, n) { | |
var L = arr.length; | |
return arr.slice(L - n).concat(arr.slice(0, L - n)); | |
}; |
''' | |
QuickSelect finds the kth smallest element of an array in linear time. | |
''' | |
def partition(arr): | |
left = [] | |
right = [] | |
if not arr: | |
return (left, right, None) |
''' | |
Given an array of integers containing duplicates, return the majority element in an array if present. A majority element appears more than n/2 times where n is the size of the array. | |
''' | |
def find_leader(arr): | |
''' | |
1. remove pairs of different elements from array | |
2. the element that still exists is a candidate | |
3. check majority of candidate, should be in len(arr) // 2 elements | |
''' |
CXX = g++-4.9 | |
CC = gcc-4.9 | |
DOXYGEN = doxygen | |
CFLAGS = -fdiagnostics-color=always -std=gnu11 -s -c -g3 -O3 -time | |
WARNINGS = -Werror -Wall -Wextra -pedantic-errors -Wformat=2 -Wno-import -Wimplicit -Wmain -Wchar-subscripts -Wsequence-point -Wmissing-braces -Wparentheses -Winit-self -Wswitch-enum -Wstrict-aliasing=2 -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wdisabled-optimization -Wunused-macros -Wno-unused | |
LDFLAGS = | |
LIBRARIES = -lcurl | |
SOURCES = main.c test.c | |
OBJECTS = $(SOURCES:.c=.o) | |
EXECUTABLE = test |