"Problem Statement: The Fibonacci sequence is defined as F(n) = F(n-1) + F(n-2) with F(0) = 1 and F(1) = 1.
The solution is given in the problem statement itself.
If the value of n = 0, return 1.
If the value of n = 1, return 1.
Otherwise, return the sum of data at (n - 1) and (n - 2).
Explanation: The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, typically starting with 0 and 1.
Java Solution:
public static int fib(int n"
Rishi G. - "Problem Statement: The Fibonacci sequence is defined as F(n) = F(n-1) + F(n-2) with F(0) = 1 and F(1) = 1.
The solution is given in the problem statement itself.
If the value of n = 0, return 1.
If the value of n = 1, return 1.
Otherwise, return the sum of data at (n - 1) and (n - 2).
Explanation: The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, typically starting with 0 and 1.
Java Solution:
public static int fib(int n"See full answer
"As far as i know, when we type a web address in the browser-
the broswer connects to the DNS server & finds the address of the website we are looking for
after finding it, the browser sends an HTTP request message to the server,with a request to send a copy of the website to the user.
all of this information is sent using TCP/IP protocol across your internet"
Debajyoti B. - "As far as i know, when we type a web address in the browser-
the broswer connects to the DNS server & finds the address of the website we are looking for
after finding it, the browser sends an HTTP request message to the server,with a request to send a copy of the website to the user.
all of this information is sent using TCP/IP protocol across your internet"See full answer
"I always ask to clarify if this is a brand new team. If so, then I focus on bringing in people with strong technical aptitudes(since I'm hiring for software engineering), but also team members that have experience mentoring and good communication is a must. I look for people who have leadership qualities. I emphasize that building a brand new team isn't something I can do on my own, so the initial hires of that team are very important to help me expand it."
Catherine I. - "I always ask to clarify if this is a brand new team. If so, then I focus on bringing in people with strong technical aptitudes(since I'm hiring for software engineering), but also team members that have experience mentoring and good communication is a must. I look for people who have leadership qualities. I emphasize that building a brand new team isn't something I can do on my own, so the initial hires of that team are very important to help me expand it."See full answer
"Binary Search on the array and after than compare the numbers at low and the high pointers whichever is closest is the answer. Because after the binary search low will be pointing to a number which is immediate greater than x and high will be pointing to a number which is immediate lesser than x.
int low = 0;
int high = n-1;
while(low <= high){
int mid = (low + high) / 2;
if(x == arr[mid]) return mid; //if x is already present then it will be the closest
else if(x < arr[mid]) high"
Shashwat K. - "Binary Search on the array and after than compare the numbers at low and the high pointers whichever is closest is the answer. Because after the binary search low will be pointing to a number which is immediate greater than x and high will be pointing to a number which is immediate lesser than x.
int low = 0;
int high = n-1;
while(low <= high){
int mid = (low + high) / 2;
if(x == arr[mid]) return mid; //if x is already present then it will be the closest
else if(x < arr[mid]) high"See full answer
Software Engineer
Data Structures & Algorithms
+1 more
🧠Want an expert answer to a question? Saving questions lets us know what content to make next.
"def missingNumber(nums : List[int]): -> int
counter = 0
for(i in range(len(nums)):
if counter != nums[i]:
return counter
counter += 1
return -1"
Abel M. - "def missingNumber(nums : List[int]): -> int
counter = 0
for(i in range(len(nums)):
if counter != nums[i]:
return counter
counter += 1
return -1"See full answer
"Clarifying
When we say cloud gaming, we refer to a video gaming experience using cloud computing, right? Assumption: Yes.
Understanding of cloud computing first. I'll use some analogies:
Imagine you are looking to do heavy computing but don't have a powerful CPU and GPU.
CPU and GPU are like your big calculators.
You can buy a powerful CPU and GPU, but problems:
It costs a lot to buy.
It costs a lot to run.
You don't need it 24-7.
You are not a un"
Darpan D. - "Clarifying
When we say cloud gaming, we refer to a video gaming experience using cloud computing, right? Assumption: Yes.
Understanding of cloud computing first. I'll use some analogies:
Imagine you are looking to do heavy computing but don't have a powerful CPU and GPU.
CPU and GPU are like your big calculators.
You can buy a powerful CPU and GPU, but problems:
It costs a lot to buy.
It costs a lot to run.
You don't need it 24-7.
You are not a un"See full answer
"A load balancer accepts requests from clients (e.g. web browsers on the Internet) and backend services (e.g. a web server). Load balancers are useful for replicating backend services onto multiple machines to meet increased demand.
The design of a load balancer should address the following questions:
What protocols should be supported?
IP allows computers to communicate using packets, similarly to how people send letters. IP packets are addressed using an IP address and port number.
"
Anonymous Hyena - "A load balancer accepts requests from clients (e.g. web browsers on the Internet) and backend services (e.g. a web server). Load balancers are useful for replicating backend services onto multiple machines to meet increased demand.
The design of a load balancer should address the following questions:
What protocols should be supported?
IP allows computers to communicate using packets, similarly to how people send letters. IP packets are addressed using an IP address and port number.
"See full answer
"Example:
bucket A: 3 liters capacity
bucket B: 5 liters capacity
goal: 4 liters
You are asked to print the logical sequence to get to the 4 liters of water in one bucket.
Follow up:
How would you solve the problem if you have more than 2 buckets of water?"
B. T. - "Example:
bucket A: 3 liters capacity
bucket B: 5 liters capacity
goal: 4 liters
You are asked to print the logical sequence to get to the 4 liters of water in one bucket.
Follow up:
How would you solve the problem if you have more than 2 buckets of water?"See full answer
"`#include
using namespace std;
void printNumbersTillN(int n){
if(n_==0){
return;
}
printNumbersTillN(n-1); // go to the end -> reach 1
cout>_n;
printNumbersTillN(n);
}`"
Jet 1. - "`#include
using namespace std;
void printNumbersTillN(int n){
if(n_==0){
return;
}
printNumbersTillN(n-1); // go to the end -> reach 1
cout>_n;
printNumbersTillN(n);
}`"See full answer
"In Java, GC is the process of automatically identifying and reclaming memory occupied by objects that are no longer reachable.. the process involves the 3 steps
Mark phase -- identify the objects that are still in use. i.e reachable
sweep Phase -- removes the unreachable objects
compact phase -- rearragnes objects to prevent fragmentation
4 types of Garbage collection
Serial GC -- single threaded simple and compacting -- best for small applications
Parrallel GC -- throughput GC"
Sue G. - "In Java, GC is the process of automatically identifying and reclaming memory occupied by objects that are no longer reachable.. the process involves the 3 steps
Mark phase -- identify the objects that are still in use. i.e reachable
sweep Phase -- removes the unreachable objects
compact phase -- rearragnes objects to prevent fragmentation
4 types of Garbage collection
Serial GC -- single threaded simple and compacting -- best for small applications
Parrallel GC -- throughput GC"See full answer