Skip to content

Instantly share code, notes, and snippets.

@thecodecafe
Last active December 4, 2019 14:55
Show Gist options
  • Save thecodecafe/3b99ab89fc7abdfb7761fe2f0d954771 to your computer and use it in GitHub Desktop.
Save thecodecafe/3b99ab89fc7abdfb7761fe2f0d954771 to your computer and use it in GitHub Desktop.

45 minutes sprint

Algorithm

Question

Given the triangle of consecutive odd numbers:

             1
          3     5
       7     9    11
   13    15    17    19
21    23    25    27    29

Calculate the row sums of this triangle from the row index (starting at index 1).

Solution should by written in PHP

E.g.

rowSumOddNumbers(1); // 1
rowSumOddNumbers(2); // 3 + 5 = 8

Database

Given a table with the following.

id name email role_id
1 Jon [email protected] 1
2 Peter [email protected] 1
3 Stanley [email protected] 1
1 Jon [email protected] 3
1 peter [email protected] 3

Write an SQL query that selects distinct emails where role_id is equal to 3 or 1.

Example Result.

email
[email protected]
[email protected]
[email protected]

Frontend

Todo list app NB: Focus on functionality not, how good it looks.

  • Add Todo
  • Remove Todo
  • Toggle completed status
  • Change todo text
@William-Amanabo
Copy link

William-Amanabo commented Dec 4, 2019

william (I'm not with my laptop right now, so I couldn't use codepen)

Sql

SELECT email from table as answers
WHERE row_I'd = 3 OR row_id = 1

Frontend

https://www.w3schools.com/code/tryit.asp?filename=G0L26L303OFN

PHP

https://repl.it/repls/OpulentHighPrinter

@Emmanuelezele123
Copy link

@Emmanuelezele123
Copy link

@Aquilla-Orie
Copy link

Aquilla-Orie commented Dec 4, 2019

CHUKWU GABRIEL

Algorithm(PHP)
https://repl.it/repls/DeliriousSkeletalDonateware

SQL

SELECT email from table
WHERE role_id = 1 OR role_id =3

I was unable to perform the task required due to time constraint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment