Maximum length of consecutive ones after deleting one element (Max Consecutive Ones After Deleting One Element) Condition: Given a non-empty array consisting of only zeros and ones. Find the maximum length of consecutive ones that can be obtained by deleting exactly one element from the array. Deleting one element is mandatory, even if the array consists entirely of ones. Input data: - nums – a non-empty array of integers, each element is 0 or 1 Output: - An integer – the maximum length of consecutive ones after deleting exactly one element Constraints: - 1 <= nums.length <= 10^5 - nums[i] is 0 or 1 Example: Go code: ```go // Available without import: sort, fmt, encoding/json package main func MaxOnes(nums []int) int { // TODO: write solution here return 0 } ``` Python code: ```python # Available without import: json, sys, io def max_ones(nums): # TODO: write solution here return 0 ```
Python
Can such a TTL decorator be used with asynchronous functions?
What is the difference between an iterator and a generator in Python?
Have you used the Singleton pattern and what do you know about it?
Have you written Dockerfile and Docker Compose? How does Docker Compose differ from Docker/Dockerfile?
In what case is the `else` block executed in a `try`/`except` construct?
What other functional tools in Python do you know or have used?
Is it possible to direct read operations to database replicas and write operations to the primary, and what are the risks of such an approach?
When is a linked list better than a regular list?
What is the difference between a single underscore, double underscore, and special names like `__name__` in Python?
What is the name of the approach where the user is not physically removed from the database, but marked as deleted or hidden?
What is the difference between an iterable object and an iterator?
Have you worked with asynchronous, multithreading, and multiprocessing?
How to avoid a situation where multiple requests trigger expensive computation simultaneously after cache expiration or absence?
Conduct a code review.
Can you design a database for a task: tables, relationships, and indexes?
Have you worked with generators?
Why can't a dictionary inside a tuple be used as a dictionary key? Is there a guarantee that a dictionary won't be passed as an argument to the decorated function?
Why can't a dictionary inside a tuple be used as a dictionary key? Is there a guarantee that a dictionary won't be passed as an argument to the decorated function?
Why can't a dictionary inside a tuple be used as a dictionary key? Is there a guarantee that a dictionary won't be passed as an argument to the decorated function?