What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-01-24 03:41:34
Write a shell script that takes two strings as input and determines whether two strings are the anagram.
function isAnagram(stringA, stringB) { // Sanitizing stringA = stringA.toLowerCase().replace(/[\W_]+/g, ""); stringB = stringB.toLowerCase().replace(/[\W_]+/g, ""); // sorting const stringASorted = stringA.split(""... Add solution -
Javascript 2022-01-23 06:20:56
javascript counting sort
const countingSort = arr => { const min = arr.reduce((acc, v) => (acc < v ? acc : v)) const max = arr.reduce((acc, v) => (acc > v ? acc : v)) const count = new Map() for (let i = min; i <= max; i++) { count[i] = 0 } for ... Add solution -
Python 2022-01-23 03:11:42
python sort multiple keys
s = sorted(s, key = lambda x: (x[1], x[2])) Add solution -
Javascript 2022-01-22 23:01:15
sort array of objects by string property value
function compareFirstNames( a, b ) { if ( a.first_name < b.first_name ){ return -1; } if ( a.first_name > b.first_name ){ return 1; } return 0; } var people =[ {"first_name":"Carol", "age&qu... Add solution -
SQL 2022-01-22 19:25:22
learnxinyminutes sql
-- Comments start with two hyphens. End each command with a semicolon. -- SQL is not case-sensitive about keywords. The sample commands here -- follow the convention of spelling them in upper-case because it makes -- it easier to distinguish them from da... Add solution -
Other 2022-01-22 16:16:01
sort dict by values
dict(sorted(x.items(), key=lambda item: item[1])) Add solution