"
read_dir(path: str) -> list[str] returns the full path of all files and sub- directories of a given directory.
is_file(path: str) -> bool: returns true if the path points to a regular file.
is_dir(path: str) -> bool: returns true if the path points to a directory.
read_file(path: str) -> str: reads and returns the content of the file.
The algorithm: notice that storing all the file contents' is too space intensive, so we can't read all the files' contents to store and compare with each"
Idan R. - "
read_dir(path: str) -> list[str] returns the full path of all files and sub- directories of a given directory.
is_file(path: str) -> bool: returns true if the path points to a regular file.
is_dir(path: str) -> bool: returns true if the path points to a directory.
read_file(path: str) -> str: reads and returns the content of the file.
The algorithm: notice that storing all the file contents' is too space intensive, so we can't read all the files' contents to store and compare with each"See full answer
"As we can pass info to only one child at a time, I told that from any given node, we have to pass the info to that child(of this node) which has the largest subtree rooted at it. To calculate the subtree sizes, I used DFS. And then to calculate the minimum time to pass info to all the nodes, I used BFS picking the largest subtree child first at every node. I couldn't write the complete code in the given time and also made a mistake in telling the overall time complexity of my approach. I think t"
Lakshman B. - "As we can pass info to only one child at a time, I told that from any given node, we have to pass the info to that child(of this node) which has the largest subtree rooted at it. To calculate the subtree sizes, I used DFS. And then to calculate the minimum time to pass info to all the nodes, I used BFS picking the largest subtree child first at every node. I couldn't write the complete code in the given time and also made a mistake in telling the overall time complexity of my approach. I think t"See full answer
"if decreasing arr, start from end and keep checking if next element increases by 1 or not. wherever not, put that value there."
Rishabh R. - "if decreasing arr, start from end and keep checking if next element increases by 1 or not. wherever not, put that value there."See full answer
"I walked through the code for a react.js based tic-tac-toe game written in typescript. The goal was to find ways to improve the code/ suggest improvements. I missed some areas like where state was being updated directly rather than using React's setState. There were issues around clear and maintainable logic, adherence to React best practices."
Natalie C. - "I walked through the code for a react.js based tic-tac-toe game written in typescript. The goal was to find ways to improve the code/ suggest improvements. I missed some areas like where state was being updated directly rather than using React's setState. There were issues around clear and maintainable logic, adherence to React best practices."See full answer
"
This is mostly correct and fairly fast.
My code has a bug somewhere where it fails on cases like the last case, where there are negative number on both ends of the array and the sums .
from collections import deque
debug = True # False
def prdbg(*x):
global debug
debug = True # False
if debug:
print(x)
else:
return
def max_sum(arr, start, end):
if type(arr) == type('''
"
Nathan B. - "
This is mostly correct and fairly fast.
My code has a bug somewhere where it fails on cases like the last case, where there are negative number on both ends of the array and the sums .
from collections import deque
debug = True # False
def prdbg(*x):
global debug
debug = True # False
if debug:
print(x)
else:
return
def max_sum(arr, start, end):
if type(arr) == type('''
"See full answer
"The question is incomplete --- the code only passes if you return the data frame sorted by BOTH department name AND rank. While in the problem description, it mentions to only rank by department name: "The results should be ordered by department name."
Not a big difference I know, but students shouldn't need to look into the solution to get the necessary knowledge to answer the question."
Chao peter Y. - "The question is incomplete --- the code only passes if you return the data frame sorted by BOTH department name AND rank. While in the problem description, it mentions to only rank by department name: "The results should be ordered by department name."
Not a big difference I know, but students shouldn't need to look into the solution to get the necessary knowledge to answer the question."See full answer
"import java.util.*;
public class NetworkTopology {
public int topologytype(int N, int M, int[] input3, int[] input4) {
if (M != N - 1 && M != N) return -1; // Fast check for invalid cases
int[] degree = new int[N + 1]; // Degree of each node (1-based indexing)
// Build the degree array
for (int i = 0; i < M; i++) {
degree[input3[i]]++;
degree[input4[i]]++;
}
// Check for Bus Topology
boolean isBus = (M"
Alessandro R. - "import java.util.*;
public class NetworkTopology {
public int topologytype(int N, int M, int[] input3, int[] input4) {
if (M != N - 1 && M != N) return -1; // Fast check for invalid cases
int[] degree = new int[N + 1]; // Degree of each node (1-based indexing)
// Build the degree array
for (int i = 0; i < M; i++) {
degree[input3[i]]++;
degree[input4[i]]++;
}
// Check for Bus Topology
boolean isBus = (M"See full answer