This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs=require('fs'); | |
var hljs=require('highlight.js'); | |
fs.readFile('D:/temp/code/345.txt','utf-8',function(err, content){ | |
if (err) throw err; | |
langEntry = hljs.highlightAuto(content); | |
console.log(langEntry.language); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.stackoverflow; | |
import java.util.Arrays; | |
import java.util.Comparator; | |
public class ContSubArray { | |
public static void main(String[] args) { | |
int[] array = | |
//{10, 5, 3, 1, 4, 2, 8, 7}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.stackoverflow; | |
import java.util.Random; | |
public class ZeroOneSorting { | |
static Random random = new Random(); | |
public static void main(String[] args) { | |
int LENGTH = 1_00_000_000; long before, after; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module: beautiful-strings | |
define function string-beauty (s :: <string>) => (n :: <integer>) | |
let repetitions = make(<simple-vector>, size: 26, fill: 0); | |
for (c in choose(alphabetic?, s)) | |
let i = as(<integer>, as-uppercase(c)) - as(<integer>, 'A'); | |
repetitions[i] := repetitions[i] + 1; | |
end for; | |
reduce1(\+, map(\*, sort(repetitions), range(from: 1, to: 26))) | |
end function string-beauty; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assume all following objects have id-constructor | |
// Book (int id) { this.bookId = id; } | |
// first book with 1 page and 8 words | |
Book book1 = new Book(1); | |
ArrayList<Page> pages = new ArrayList<Page>(); // create holder for pages | |
Page page1 = new Page(1); // create page | |
pages.add(page1); // bind page to pages | |
ArrayList<Word> words = new ArrayList<Word>(); // create holder for words | |
// filling words list |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns cups.darkus) | |
;; data | |
(def sentences (seq (.split (slurp "res/FPC_May2012_tsk.txt") "\r\n"))) | |
(def priority {:add 0.0001 :sub 0.0 :mul 0.0002 :div 0.0003}) | |
(def features {"поровну" {:add 0 :sub 0 :mul 0 :div 1} | |
"всего\\?" {:add 1 :sub 0 :mul 1 :div 0} | |
" (П|п)о \\d+" {:add 0 :sub 0 :mul 0.9 :div 0.9} |
NewerOlder