Просмотр исходного кода

Added some more problems and structure

master
Lachlan Jacob 5 лет назад
Родитель
Сommit
76028e5562
15 измененных файлов: 73 добавлений и 1 удалений
  1. 3
    0
      125/problem.txt
  2. 2
    0
      175/main.sql
  3. 29
    0
      175/problem.txt
  4. 3
    0
      175/run.sh
  5. 1
    0
      176/main.sql
  6. 1
    0
      176/problem.txt
  7. 3
    0
      176/run.sh
  8. 1
    0
      182/main.sql
  9. 1
    0
      182/problem.txt
  10. 3
    0
      182/run.sh
  11. 15
    0
      66/main.py
  12. 5
    0
      66/problem.txt
  13. 3
    0
      66/run.sh
  14. 2
    1
      README.md
  15. 1
    0
      all.sh

+ 3
- 0
125/problem.txt Просмотреть файл

@@ -0,0 +1,3 @@
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.

Note: For the purpose of this problem, we define empty string as valid palindrome.

+ 2
- 0
175/main.sql Просмотреть файл

@@ -0,0 +1,2 @@
SELECT FirstName, LastName, City, State FROM Person
LEFT JOIN Address ON Person.PersonId = Address.PersonId;

+ 29
- 0
175/problem.txt Просмотреть файл

@@ -0,0 +1,29 @@
Table: Person

+-------------+---------+
| Column Name | Type |
+-------------+---------+
| PersonId | int |
| FirstName | varchar |
| LastName | varchar |
+-------------+---------+
PersonId is the primary key column for this table.

Table: Address

+-------------+---------+
| Column Name | Type |
+-------------+---------+
| AddressId | int |
| PersonId | int |
| City | varchar |
| State | varchar |
+-------------+---------+
AddressId is the primary key column for this table.


Write a SQL query for a report that provides the following information for each person in the Person table, regardless if there is an address for each of those people:

FirstName, LastName, City, State



+ 3
- 0
175/run.sh Просмотреть файл

@@ -0,0 +1,3 @@
#!/bin/bash

echo "Can't be botherd making this into a test"

+ 1
- 0
176/main.sql Просмотреть файл

@@ -0,0 +1 @@
SELECT MAX(Salary) AS SecondHighestSalary FROM Employee WHERE Salary != (SELECT MAX(Salary) FROM Employee);

+ 1
- 0
176/problem.txt Просмотреть файл

@@ -0,0 +1 @@
Write a SQL query to get the second highest salary from the Employee table.

+ 3
- 0
176/run.sh Просмотреть файл

@@ -0,0 +1,3 @@
#!/bin/bash

echo "Can't be botherd making this into a test"

+ 1
- 0
182/main.sql Просмотреть файл

@@ -0,0 +1 @@
SELECT Email FROM (SELECT Email, COUNT(Email) AS cnt FROM Person GROUP BY Email) AS b WHERE cnt > 1;

+ 1
- 0
182/problem.txt Просмотреть файл

@@ -0,0 +1 @@
Write a SQL query to find all duplicate emails in a table named Person

+ 3
- 0
182/run.sh Просмотреть файл

@@ -0,0 +1,3 @@
#!/bin/bash

echo "Can't be botherd making this into a test"

+ 15
- 0
66/main.py Просмотреть файл

@@ -0,0 +1,15 @@
class Solution:
def plusOne(self, digits):
numberString = ""
for n in digits:
numberString += str(n)

number = int(numberString) + 1
final = []
for digit in str(number):
final.append(int(digit))
return final

s = Solution()
print("Expected: [1, 2, 4]")
print("Got:", str(s.plusOne([1, 2, 3])))

+ 5
- 0
66/problem.txt Просмотреть файл

@@ -0,0 +1,5 @@
Given a non-empty array of digits representing a non-negative integer, plus one to the integer.

The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit.

You may assume the integer does not contain any leading zero, except the number 0 itself.

+ 3
- 0
66/run.sh Просмотреть файл

@@ -0,0 +1,3 @@
#!/bin/bash

python3 main.py

+ 2
- 1
README.md Просмотреть файл

@@ -8,8 +8,9 @@ Aiming for one a day, to try be a little consistent.

Folder Names will Be Puzzle Numbers and contain:

- `problem.txt` - A plain text file with a problem description.
- `main.<language extension>` will be the code submitted. (Some code may have to be modified to run outside of LeetCode's driver).
- run.sh (This will contain a bash scipt to run/compile+run the code.
- `run.sh` (This will contain a bash scipt to run/compile+run the code.

## Necessary Dependencies


+ 1
- 0
all.sh Просмотреть файл

@@ -2,6 +2,7 @@

for f in *; do
if [ -d ${f} ]; then
echo ""
echo "Running Problem: $f"
cd $f
./run.sh

Загрузка…
Отмена
Сохранить