Couple of days ago I read a story in Business Insider about Google’s recruitment process. Here is the original post “How to get a job at Google in Europe, according to experts — Business Insider” covered by Caterina Dassie.
Here I shared only the focused part of that story.
Keith Moran, former staffing leader for Europe, the Middle East and Africa at Google, told that it takes an average of eight weeks between your first contact with a Google recruiter and a job offer, but it can take longer than 12 weeks. …
Google Foobar is Google’s secret hiring challenge. Google uses it to hire some of the best developers around the globe which they think can be a good match for their organization. Many developers in Google have been hired through this hiring challenge.
There were 5 levels and 9 problems in this challenge.
Level 1 has 1 problem, level 2 has 2 problems, level 3 has 3 problems, level 4 has 2 problems and level 5 has 1 problem.
A recursive function is tail recursive when recursive call is the last thing executed by the function. For example the following Python function factorial() is tail recursive.
If a recursive function calling itself and that recursive call is the first statement in the function then it’s known as Head Recursion.There’s no statement, no operation before the call. The function doesn’t have to process or perform any operation at the time of calling and all operations are done at returning time.
Tail recursion is just a particular instance of recursion, where the return value of a function is calculated as a call to itself, and nothing else. …
The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called as recursive function.
A physical world example would be to place two parallel mirrors facing each other. Any object in between them would be reflected recursively.
Using recursive algorithm, certain problems can be solved quite easily. Examples of such problems are Towers of Hanoi (TOH), Fibonacci Series, nCr, Factorial etc.
Types of Recursions:
Time complexity is the number of operations an algorithm performs to complete its task (considering that each operation takes the same amount of time). The algorithm that performs the task in the smallest number of operations is considered the most efficient one in terms of the time complexity.
Space complexity is the amount of memory used by the algorithm (including the input values to the algorithm) to execute and produce the result.
In our daily life when we do any work or any task, we want to know how much time it takes to performing that particular task. …
The abstract data type is special kind of data type, whose behavior is defined by a set of values and set of operations. The keyword “Abstract” is used as we can use these data types, we can perform different operations. But how those operations are working that is totally hidden from the user. The ADT is made of primitive data types, but operation logics are hidden.
Some examples of ADT are Stack, Queue, List etc.
The stack abstract data type is defined by the following structure and operations. A stack is structured, as described above, as an ordered collection of items where items are added to and removed from the end called the “top”. Stacks are ordered LIFO. …
Memory management is the process of efficiently allocating, de-allocating, and coordinating memory so that all the different processes run smoothly and can optimally access different system resources. Memory management also involves cleaning memory of objects that are no longer being accessed.
In Python, the memory manager is responsible for these kinds of tasks by periodically running to clean up, allocate, and manage the memory. Unlike C, Java, and other programming languages, Python manages objects by using reference counting. This means that the memory manager keeps track of the number of references to each object in the program. …
Python interpreter supports many functions that are builtin.
abs(): The abs() method returns the absolute value of the given number. If the number is a complex number, abs() returns its magnitude.
# Random integer number
integer = -10print('Absolute value of -10 is:', abs(integer))# Random floating number
floating = -10.33print('Absolute value of -10.33 is:', abs(floating))# Random complex number
complex = (5 - 2j)print('Magnitude of 5 - 2j is:', abs(complex))
Absolute value of -10 is: 10
Absolute value of -10.33 is: 10.33
Magnitude of 5–2j is: 5.385164807134504
divmod(): The divmod() method takes two numbers and returns a pair of numbers (a tuple) consisting of their quotient and remainder. …
Every value in Python has a datatype. Since everything is an object in Python programming, data types are actually classes and variables are instance (object) of these classes.
There are various data types in Python. Some of the important types are listed below.
Integers, floating point numbers and complex numbers falls under Python numbers category. They are defined as int, float and complex class in Python.
We can use the type() function to know which class a variable.
# Here a is int
a = 5print(a, "is of type", type(a))# Here a is float
a = 2.0print(a, "is of type"…
A data structure is a way we store and organize our data. For example, think about organizing books in a room, we can keep those books on a shelf, or make a stack of them on a table or even just put them randomly anywhere in the room.
Thus, we have different options to organize books in a room or in different words, we have different structures to keep books. In computers also, we have a similar scenario i.e., we can organize our data in the way we want and these different ways of organizing data are different data structures.
For example, an array is a type of data structure which we learn while learning basic programming languages. …