GeezerVison is showing github.com — Deleted some bad chars · johnsonhit/coding-problems@42f842b
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: Linked Lists/is_ascending_ll.py +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | ''' | 2 | 2 | Ascending Linked List | 3 | 3 |
| 4 | | -Determine whether the sequence of items is ascending so that its each element is strictly larger | 5 | | -than (and not merely equal to) the element that precedes it. Return True if that is the case, and | 6 | | -return False otherwise. | | 4 | +Determine whether the sequence of items is ascending so that its each element is strictly larger | | 5 | +than (and not merely equal to) the element that precedes it. Return True if that is the case, and | | 6 | +return False otherwise. | 7 | 7 |
| 8 | 8 | Input: -5 -> 10 -> 99 -> 123456 | 9 | 9 | Output: True | |
Collapse file Copy file name to clipboardExpand all lines: Linked Lists/max_difference_subll.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | ''' | 2 | 2 | Maximum Difference Sub-Linked List | 3 | 3 |
| 4 | | -Given a linked list of integers, find and return the sub-linked list of k consecutive elements where | | 4 | +Given a linked list of integers, find and return the sub-linked list of k consecutive elements where | 5 | 5 | the difference between the smallest element and the largest element is the largest possible. | 6 | | -If there are several sub-linked lists of k elements in items so that all these sub-linked list have | | 6 | +If there are several sub-linked lists of k elements in items so that all these sub-linked list have | 7 | 7 | the same largest possible difference, return the sub-linked list that occurs first. | 8 | 8 |
| 9 | 9 | Input: 42 -> 17 -> 99 -> 12 -> 65 -> 77 -> 11 -> 26, 5 | |
Collapse file Copy file name to clipboardExpand all lines: Other/postfix_evaluate.py +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | Postfix Evaluate | 3 | 3 |
| 4 | 4 | When arithmetic expressions are given in the familiar infix notation 2 + 3 * 4, we need to use | 5 | | -parentheses to force a different evaluation order than the usual PEMDAS order determined by | 6 | | -precedence and associativity . Writing arithmetic expressions in postfix notation (also known as | 7 | | -Reverse Polish Notation ) may look strange to us humans accustomed to the conventional infix | | 5 | +parentheses to force a different evaluation order than the usual PEMDAS order determined by | | 6 | +precedence and associativity. Writing arithmetic expressions in postfix notation (also known as | | 7 | +Reverse Polish Notation) may look strange to us humans accustomed to the conventional infix | 8 | 8 | notation, but is computationally much easier to handle, since postfix notation allows any evaluation | 9 | 9 | order to be expressed without using any parentheses at all! A postfix expression is given as a list of | 10 | | -items that can be either individual integers or one of the strings '+' , '-' , '*' and '/' for the four | | 10 | +items that can be either individual integers or one of the strings '+', '-', '*' and '/' for the four | 11 | 11 | possible arithmetic operators. Calculate the result of the postfix expression. | 12 | 12 |
| 13 | 13 | Input: [2, 3, '+', 4, '*'] | |
Collapse file Copy file name to clipboardExpand all lines: Other/safe_squares_rooks.py +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | ''' | 2 | 2 | Safe Squares from Rooks | 3 | 3 |
| 4 | | -On a generalized n-by-n chessboard, there are some number of rooks , each rook represented as a | 5 | | -two-tuple (row, column) of the row and the column that it is in. (The rows and columns are | 6 | | -numbered from 0 to n-1.) A chess rook covers all squares that are in the same row or in the same | 7 | | -column as that rook. Given the board size n and the list of rooks on that board, count the number of | | 4 | +On a generalized n-by-n chessboard, there are some number of rooks, each rook represented as a | | 5 | +two-tuple (row, column) of the row and the column that it is in. (The rows and columns are | | 6 | +numbered from 0 to n-1.) A chess rook covers all squares that are in the same row or in the same | | 7 | +column as that rook. Given the board size n and the list of rooks on that board, count the number of | 8 | 8 | empty squares that are safe, that is, are not covered by any rook. | 9 | 9 |
| 10 | 10 | Input: [(1, 1), (3, 5), (7, 0), (7, 6)], 8 | |
Collapse file Copy file name to clipboardExpand all lines: Strings/reverse_vowels.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | ''' | 2 | 2 | Reverse Vowels | 3 | 3 |
| 4 | | -Given a text string, create and return a new string constructed by finding all its vowels (for | 5 | | -simplicity, in this problem vowels are the letters in the string 'aeiouAEIOU' ) and reversing their | | 4 | +Given a text string, create and return a new string constructed by finding all its vowels (for | | 5 | +simplicity, in this problem vowels are the letters in the string 'aeiouAEIOU') and reversing their | 6 | 6 | order, while keeping all non-vowel characters exactly as they were in their original positions. | 7 | 7 |
| 8 | 8 | Input: 'Hello world' | |
|