Python practice1
Write a function fizz_buzz_extended(n)
that returns a list of integers from 1 to n
, but for multiples of 3, append "Fizz"
, for multiples of 5 append "Buzz"
, and for multiples of both 3 and 5 append "FizzBuzz":
2. Problem: Find the Longest Substring Without Repeating Characters
Write a function longest_substring(s)
that returns the length of the longest substring of a given string s
without repeating characters.
Problem: Flatten a Nested List
Write a function flatten(lst)
that takes a nested list and returns a flattened version.
Problem: Valid Parentheses
Write a function is_valid_parentheses(s)
that checks if a string containing only parentheses ()[]{}
is valid.
Problem: Find Prime Numbers
Write a function find_primes(n)
that returns a list of prime numbers up to n
.
Problem: Group Anagrams
Write a function group_anagrams(words)
that groups words that are anagrams of each other.
Problem: Merge Intervals
Write a function merge_intervals(intervals)
that merges overlapping intervals.
Problem: Reverse Linked List
Given a singly linked list, write a function to reverse it.