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
| import os | |
| import shutil | |
| def organize_files(): | |
| downloads_folder = os.path.join(os.path.expanduser("~"), "Downloads") | |
| subfolders = { | |
| "Images": [".jpeg", ".jpg", ".tiff", ".gif", ".bmp", ".png", ".bpg", ".svg", ".heif", ".psd"], | |
| "Videos": [".avi", ".flv", ".wmv", ".mov", ".mp4", ".webm", ".vob", ".mng", ".qt", ".mpg", ".mpeg", ".3gp"], | |
| "Documents": [".pdf", ".oxps", ".epub", ".pages", ".docx", ".doc", ".fdf", ".ods", ".odt", ".pwi", ".xsn", ".xps", ".dotx", ".docm", ".dox", ".rvg", ".rtf", ".rtfd", ".wpd", ".xls", ".xlsx", ".ppt", ".pptx"], |
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
| int binary_search(int* nums, int numsSize, int target){ | |
| int middle; | |
| int min; | |
| int max; | |
| middle = numsSize / 2; | |
| if (target < nums[middle]) | |
| { | |
| min = 0; | |
| max = middle; |
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
| /** | |
| * @param {number[]} nums | |
| * @param {number} target | |
| * @return {number[]} | |
| */ | |
| var twoSum = function(nums, target) { | |
| const sum = []; | |
| for (let i = 0; i < nums.length; i++) { | |
| for (let j = i + 1; j < nums.length; j++) { | |
| if (nums[i] + nums[j] === target) { |
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
| int str_len(char *s) | |
| { | |
| int i; | |
| i = 0; | |
| while(s[i] != '\0') | |
| i++; | |
| return (i); | |
| } |
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
| //If the number is even, you divide it by 2, if it's odd, you subtract one from the number. That's the possible steps. | |
| int numberOfSteps(int num){ | |
| static int steps = 0; | |
| int tmp = 0; | |
| int firstCall; | |
| firstCall = 0; | |
| if (num % 2 == 0 && num != 0) | |
| { | |
| if(steps == 0) |
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
| int max_wealth(int** accounts, int accountsSize, int* accountsColSize){ | |
| int mainWealth; | |
| int tmpW; | |
| int i; | |
| int j; | |
| i = 0; | |
| mainWealth = 0; | |
| tmpW = 0; | |
| while(i < accountsSize) |
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
| int ft_lstsize(struct ListNode *lst) | |
| { | |
| int index; | |
| index = 0; | |
| while (lst) | |
| { | |
| index++; | |
| lst = lst->next; | |
| } |
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
| int romanToInt(char *s){ | |
| int i; | |
| int num; | |
| num = 0; | |
| i = 0; | |
| while(s[i] != '\0') | |
| { | |
| if(s[i] == 'I') | |
| { | |
| if(s[i + 1] == 'V') |
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
| #include <stdio.h> | |
| #include <unistd.h> | |
| void print_char_bnry(unsigned char c) | |
| { | |
| int i; | |
| char c_tmp; | |
| i = 8; | |
| while (--i >= 0) |
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
| function zipper_merge(array1, array2) { | |
| if (array1.length != array2.length) { | |
| return null; | |
| } | |
| var array3 = {}; | |
| var count = 0; | |
| var pos = 0; | |
| while(pos<array1.length*2){ | |
| array3[pos]=array1[count]; |
NewerOlder