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
type Maybe<T> = T|undefined; | |
function generateCompareArray<T, U>(first: T[], second: T[], | |
keyExtractor: (item: T) => U, | |
keyComparer: (first: U, second: U) => number | |
): {first: Maybe<T>, second: Maybe<T>}[] { | |
const fschwartz = first.map(item => ({item, key: keyExtractor(item)})); | |
fschwartz.sort((a, b) => keyComparer(a.key, b.key)); | |
const sschwartz = second.map(item => ({item, key: keyExtractor(item)})); | |
sschwartz.sort((a, b) => keyComparer(a.key, b.key)); |
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
using System; | |
using System.IO; | |
using System.Linq; | |
namespace Umcnmk | |
{ | |
/// <summary> | |
/// Represents a Unique Master Citizen Number class(Macedonian UMCN) | |
/// Read more: https://www.uvmk.gov.mk/files/zakoni/Maticen_broj_na_graganinot_92.pdf | |
/// </summary> |
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
~ | |
~ | |
~ |
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
interface IGeneric<T> | |
{ | |
T GetValue(T param); | |
} | |
class Implementation: IGeneric<string>, IGeneric<int> | |
{ | |
public string GetValue(string input) { | |
return "Bane "+input; | |
} |
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
render() { | |
return <FancyInputBox {...placeholderObject}> | |
</FancyInputBox>; | |
} |
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
const { placeholder } = this.props; | |
const placeholderObject = placeholder ? {placeholder} : {}; |
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
render() { | |
return <FancyInputBox placeholder={"Enter first name"}> | |
</FancyInputBox>; | |
} |
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
render() { | |
return <FancyInputBox></FancyInputBox>; | |
} |
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
interface Array<T> { | |
syncForEach(action: (value: T, index: number, array: T[]) => Promise<void>): void; | |
} | |
if (!Array.prototype.syncForEach) { | |
Array.prototype.syncForEach = async function<T> (action: (value: T, index: number, array: T[]) => Promise<void>): Promise<void> { | |
if (this == null) { | |
throw new TypeError('Array.prototype.syncForEach called on null or undefined'); | |
} |
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
string Solution(int[] source){ | |
var sum = source.Sum(); | |
if (sum % 3 != 0) | |
return "Impossible"; | |
sum /= 3; | |
var opts = Enumerable.Range(0, 1 << source.Length) | |
.Select(i => source.Where((s, x) => ((1 << x) & i)!=0)) | |
.Where(o => o.Sum()==sum) | |
.ToList(); |
NewerOlder