Last active
February 20, 2025 20:52
-
-
Save theCompanyDream/e7a63b9cb68493cd4998b0ffc72267b4 to your computer and use it in GitHub Desktop.
SWE Contractor test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import requests | |
def find_files(url): | |
soup = BeautifulSoup(requests.get(url).text, 'html.parser') | |
for a in soup.find_all('a'): | |
href = a.get('href') | |
# Check if href exists and does not end with a slash (i.e., it's likely a file) | |
if href and not href.endswith('/') and href != "../": | |
yield href | |
for file in find_files("https://gentoo.osuosl.org/distfiles/"): | |
print(file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def longest_increasing_subsequence(nums): | |
if not nums: | |
return 0 | |
n = len(nums) | |
dp = [1] * n # Every element is an increasing subsequence of length 1 | |
for i in range(1, n): | |
for j in range(i): | |
if nums[i] > nums[j]: | |
dp[i] = max(dp[i], dp[j] + 1) | |
return max(dp) | |
# Example usage: | |
nums = [11, 5, 2, 5, 3, 7, 101, 18] | |
print(longest_increasing_subsequence(nums)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
image_id, | |
CASE | |
WHEN score >= 0.5 THEN 1 -- Strong label | |
ELSE 0 -- Weak label | |
END AS weak_label | |
FROM unlabeled_image_predictions | |
ORDER BY image_id; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find . -maxdepth 1 -type f -name "*.txt" -mtime -30 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment