Hello, I have the following object:
{
h: 1,
o: 5,
l: 3,
a: 6,
m: 3,
i: 4,
n: 3,
b: 2,
r: 4,
e: 5,
s: 3,
y: 1,
u: 1,
v: 2,
j: 1
}
How do you return the letter that has the highest value? it's a test, thanks
Hello, I have the following object:
{
h: 1,
o: 5,
l: 3,
a: 6,
m: 3,
i: 4,
n: 3,
b: 2,
r: 4,
e: 5,
s: 3,
y: 1,
u: 1,
v: 2,
j: 1
}
How do you return the letter that has the highest value? it's a test, thanks
I had an interview for a company that gave me the following exercise as part of the technical test.
Given the array let array = ['ab', 'abb', 'abbabbabbaa']
remove the repeated contiguous letters and return the array sorted from highest to lowest.
The expected output was :['abababa','ab','ab']
But I couldn't solve it, I knew I should use map
and filter
but I didn't know how to fix it. My solution was to iterate each of the words with map and convert to a set each one to eliminate the repeated ones but it eliminated all the repeated letters of each position leaving something like the following ['ab','ab','ab']
.
my solution was:
let data = ["ab", "abb", "abbabbabbaa"]
const newData = data.map((el, index) => [...new Set(el)])
console.log(newData)
How would you solve it? I wouldn't want to find myself back with the same problem without a solution! Thanks in advance
I want to know if there is any way that within a WHERE
if the result is 1
that it does such and if 0
it does such and such. as a IF
.
The problem I have is that I am wanting to attach the prices to a document. But one of the codes is priceless in price_code = 1
. Therefore, I delete the result line because it does not meet the condition.
Rescued from comments: If when I look price_code = 1
up it doesn't find a value then I should go look up the Cost in table costs
, column cost_price
.
I leave a summary:
SQL scripts:
SQL
SELECT a.item_code, a.trx_type, a.trx_num, a.qty, b.list_price
FROM moves AS a
INNER JOIN items_price AS b
ON a.item_code = b.item_code
INNER JOIN costs AS c
ON a.item_code = c.item_code
WHERE b.price_code = '1'
ORDER BY a.item_code DESC;