I hereby claim:
- I am gabidavila on github.
- I am gabidavila (https://keybase.io/gabidavila) on keybase.
- I have a public key whose fingerprint is 9656 6392 F402 856F A447 B80B 2B8E F14E CC27 3FD3
To claim this, I am signing this object:
2.4.1 :001 > user = User.first | |
User Load (0.9ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1 [["LIMIT", 1]] | |
=> #<User id: 1, name: "Gabriela", created_at: "2018-02-06 14:25:06", updated_at: "2018-02-06 14:25:06"> | |
2.4.1 :002 > Address.create(street: "111 8th Ave", city: "New York", state: "NY", user: user) | |
(0.2ms) BEGIN | |
SQL (1.9ms) INSERT INTO "addresses" ("street", "city", "state", "user_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6) RETURNING "id" [["street", "111 8th Ave"], ["city", "New York"], ["state", "NY"], ["user_id", 1], ["created_at", "2018-02-06 14:28:51.050940"], ["updated_at", "2018-02-06 14:28:51.050940"]] | |
(5.7ms) COMMIT | |
=> #<Address id: 1, street: "111 8th Ave", city: "New York", state: "NY", zipcode: nil, user_id: 1, created_at: "2018-02-06 14:28:51", updated_at: "2018-02-06 14:28:51"> | |
2.4.1 :003 > user | |
=> #<User id: 1, name: "Gabriela", created_at: "2018-02-06 14:25:06", updated_at: "2018-02-06 14:25:06"> |
I hereby claim:
To claim this, I am signing this object:
MySQL 5.7 doesn't support division by 0 in write operations. However in virtual columns they are allowed, but if you try to update a row that previously had division by zero to another value so not to cause the division by zero you get an error and the row gets immutable.
Create a table trips
as the following:
CREATE TABLE trips (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
start_time DATETIME NOT NULL,
end_time DATETIME NOT NULL,
distance INT(10) NOT NULL DEFAULT 0,
function reverseString(word) { | |
const new_word = []; | |
const array_chars = word.split(""); | |
const last_index = array_chars.length - 1; | |
for (let i = 0; i <= Math.ceil(array_chars.length/2); i++) { | |
new_word[last_index - i] = array_chars[i]; | |
new_word[i] = array_chars[last_index - i] | |
} | |
WITH RECURSIVE fibonacci(recursion_level, fibonacci_number, next_number) | |
AS ( | |
# Base Case | |
SELECT 0 AS recursion_level, | |
0 AS fibonacci_number, | |
1 AS next_number | |
UNION ALL | |
# Recursion query | |
SELECT recursion_level + 1 AS recursion_level, | |
next_number AS fibonacci_number, |
For an instance, forget that arrays and strings exists. Your challenge, is to say if a number is a palindrome or not using mostly mathematical approach.
The string you will receive (because it is an user input), it always positive. You can assume that every 0 <= n < 10
is a palindrome.
aaaa |
aaaaa |