Coding Interview Resources
50.3K subscribers
692 photos
7 files
399 links
This channel contains the free resources and solution of coding problems which are usually asked in the interviews.

Managed by: @love_data
Download Telegram
10 Ways to Speed Up Your Python Code

1. List Comprehensions
numbers = [x**2 for x in range(100000) if x % 2 == 0]
instead of
numbers = []
for x in range(100000):
if x % 2 == 0:
numbers.append(x**2)

2. Use the Built-In Functions
Many of Python’s built-in functions are written in C, which makes them much faster than a pure python solution.

3. Function Calls Are Expensive
Function calls are expensive in Python. While it is often good practice to separate code into functions, there are times where you should be cautious about calling functions from inside of a loop. It is better to iterate inside a function than to iterate and call a function each iteration.

4. Lazy Module Importing
If you want to use the time.sleep() function in your code, you don't necessarily need to import the entire time package. Instead, you can just do from time import sleep and avoid the overhead of loading basically everything.

5. Take Advantage of Numpy
Numpy is a highly optimized library built with C. It is almost always faster to offload complex math to Numpy rather than relying on the Python interpreter.

6. Try Multiprocessing
Multiprocessing can bring large performance increases to a Python script, but it can be difficult to implement properly compared to other methods mentioned in this post.

7. Be Careful with Bulky Libraries
One of the advantages Python has over other programming languages is the rich selection of third-party libraries available to developers. But, what we may not always consider is the size of the library we are using as a dependency, which could actually decrease the performance of your Python code.

8. Avoid Global Variables
Python is slightly faster at retrieving local variables than global ones. It is simply best to avoid global variables when possible.

9. Try Multiple Solutions
Being able to solve a problem in multiple ways is nice. But, there is often a solution that is faster than the rest and sometimes it comes down to just using a different method or data structure.

10. Think About Your Data Structures
Searching a dictionary or set is insanely fast, but lists take time proportional to the length of the list. However, sets and dictionaries do not maintain order. If you care about the order of your data, you can’t make use of dictionaries or sets.
πŸ‘2❀1
Python interview questions 😍😍

What is Python?

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics, automatic memory management.

What's the difference between a tuple and a list?

Both tuples and lists are data structures in Python and hold a list of values. Unlike lists, tuples are immutable - they can't be changed.


What is a dict and what's its most important limitation?

A dict is a structure akin a hash map. It stores key-value pairs, where keys are unique and it has O(1) access time. The most important limitation for a dict is that the keys must be hashable/immutable. Meaning, we can use a tuple as a key, but not a list.


What is pickling/unpickling?

Pickling is converting an object to a string representation in python. Generally used for caching and transferring objects between hosts/processes.

Is Python a Scripting Language?

Python is capable of scripting, but it is more than that. It is considered as a general-purpose programming language.
πŸ‘2

Explain the features of Python / Say something about the benefits of using Python?


Python is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Web Development Domain. I will list down some of the key advantages of learning Python:

β—‹ Simple and easy to learn:
* Learning python programming language is easy and fun.
* Compared to other language, like, Java or C++, its syntax is a way lot easier.
* You also don’t have to worry about the missing semicolons (;) in the end!
* It is more expressive means that it is more understandable and readable.
* Python is a great language for the beginner-level programmers.
* It supports the development of a wide range of applications from simple text processing to WWW browsers to games.
* Easy-to-learn βˆ’ Python has few keywords, simple structure, and a clearly defined syntax. This makes it easy for Beginners to pick up the language quickly.
* Easy-to-read βˆ’ Python code is more clearly defined and readable. It's almost like plain and simple English.
* Easy-to-maintain βˆ’ Python's source code is fairly easy-to-maintain.


Features of Python
β—‹ Python is Interpreted βˆ’
* Python is processed at runtime by the interpreter.
* You do not need to compile your program before executing it. This is similar to PERL and PHP.

β—‹ Python is Interactive βˆ’
* Python has support for an interactive mode which allows interactive testing and debugging of snippets of code.
* You can open the interactive terminal also referred to as Python prompt and interact with the interpreter directly to write your programs.

β—‹ Python is Object-Oriented βˆ’
* Python not only supports functional and structured programming methods, but Object Oriented Principles.

β—‹ Scripting Language β€”
* Python can be used as a scripting language or it can be compliled to byte-code for building large applications.

β—‹ Dynammic language β€”
* It provides very high-level dynamic data types and supports dynamic type checking.

β—‹ Garbage collection β€”
* Garbage collection is a process where the objects that are no longer reachable are freed from memory.
* Memory management is very important while writing programs and python supports automatic garbage collection, which is one of the main problems in writing programs using C & C++.

β—‹ Large Open Source Community β€”
* Python has a large open source community and which is one of its main strength.
* And its libraries, from open source 118 thousand plus and counting.
* If you are stuck with an issue, you don’t have to worry at all because python has a huge community for help. So, if you have any queries, you can directly seek help from millions of python community members.
* A broad standard library βˆ’ Python's bulk of the library is very portable and cross-platform compatible on UNIX, Windows, and Macintosh.
* Extendable βˆ’ You can add low-level modules to the Python interpreter. These modules enable programmers to add to or customize their tools to be more efficient.

β—‹ Cross-platform Language β€”
* Python is a Cross-platform language or Portable language.
* Python can run on a wide variety of hardware platforms and has the same interface on all platforms.
* Python can run on different platforms such as Windows, Linux, Unix and Macintosh etc.
πŸ‘5
PYTHON INTERVIEW QUESTIONS

1 what is python ?
2 why python ?
3 what are advantage of python ?
4 what is pep 8 ?
5. What do you mean by literal ?
6 explain python function ?
7 what is use of break statement ?
8 what is tuple ?
9 python libraries /module ?
10. What is an in operator in python ?
11 why python interpreted ?
12 how is memory managed in python ?
13 python decorator ?
14 global variable / local variable ?
15 what is iterators in python ?
16 what is slicing in python ?
17 what is a dictionary in python ?
18 what is pass in python ?
19 what isinit ?
20 what is self in python ?

Most important for Technical round interview.
πŸ‘4
This is an amazing opportunity to test your coding skills
Try to be in Top 1000 to claim amazing Rewards πŸ‘πŸ‘
Problem: Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.

Solution: Every pair of points on a plane define a line that passes through them. One approach is to iterate over each pair of points, find a line that passes through them and check how many of the other points lie on this line. This solution will be O(n^3). We can do better if we reformulate our approach a little bit. Let's say we found lines that pass through every pair of points. Some of them might be the same. E.g. if there is a line that passes through 3 points a,b,c, than lines that pass through a-b, b-c and a-c will coincide. So, we can count how many lines coincide and calculate the number of points that this line pass through. To find lines, that coincide, we can put them in hash map. The only problem is numeric instability, i.e. when dealing with floating point numbers it's likely we won't get lines, whose coefficients match exactly. One way to solve it is to use buckets of size \epsilon. Then we need to iterate over lines that are inside a bucket and check how many of them are actually the same.
πŸš€Top technology trends that you can learn ...

1. Web 3.0 and Blockchain
2. AI and ML
3. IOT
4. Automation
5. Cybersecurity
6. Voice technology
7. 5G
8. Edge computing
9. Virtual Reality
10. Analytics
Software Engineer: C++ C# Java, Python, JavaScript

Web Dev: HTML, CSS, JavaScript, NodeJS

Game Dev: Unity, Unreal, Java

App Dev: Flutter, Objective C, Java, Swift, Kotlin, React

Cyber Security: Python, Linux, Networking

AI & Data Science - Julia, Haskell
πŸ‘4
PREPARING FOR AN ONLINE INTERVIEW?

10 basic tips to consider when invited/preparing for an online interview:

1. Get to know the online technology that the interviewer(s) will use. Is it a phone call, WhatsApp, Skype or Zoom interview? If not clear, ask.

2. Familiarize yourself with the online tools that you’ll be using. Understand how Zoom/Skype works and test it well in advance. Test the sound and video quality.

3. Ensure that your internet connection is stable. If using mobile data, make sure it’s adequate to sustain the call to the end.

4. Ensure the lighting and the background is good. Remove background clutter. Isolate yourself in a place where you’ll not have any noise distractions.

5. For Zoom/Skype calls, use your desktop or laptop instead of your phone. They’re more stable especially for video calls.

6. Mute all notifications on your computer/phone to avoid unnecessary distractions.

7. Ensure that your posture is right. Just because it’s a remote interview does not mean you slouch on your couch. Maintain an upright posture.

8. Prepare on the other job specifics just like you would for a face-to-face interview

9. Dress up like you would for a face-to-face interview.

10. Be all set at least 10 minutes to the start of interview.
πŸ‘2
How long are coding interviews?
The phone screen portion of the coding interview typically lasts up to one hour. The second, more technical part of the interview can take multiple hours.

Where can I practice coding?
There are many ways to practice coding and prepare for your coding interview. LeetCode provides practice opportunities in more than 14 languages and more than 1,500 sample problems. Applicants can also practice their coding skills and interview prep with HackerRank.

How do I know if my coding interview went well?
There are a variety of indicators that your coding interview went well. These may include going over the allotted time, being introduced to additional team members, and receiving a quick response to your thank you email.
πŸ‘5
8 Best Note-Taking Apps for Programmers

πŸ“œ Notion
πŸ“œ CoderNotes
πŸ“œ Quiver
πŸ“œ MedleyText
πŸ“œ Boostnote
πŸ“œ Stackedit
πŸ“œ Evernote
πŸ“œ Microsoft onenote
Typical java interview questions sorted by experience


Junior
* Name some of the characteristics of OO programming languages
* What are the access modifiers you know? What does each one do?
* What is the difference between overriding and overloading a method in Java?
* What’s the difference between an Interface and an abstract class?
* Can an Interface extend another Interface?
* What does the static word mean in Java?
* Can a static method be overridden in Java?
* What is Polymorphism? What about Inheritance?
* Can a constructor be inherited?
* Do objects get passed by reference or value in Java? Elaborate on that.
* What’s the difference between using == and .equals on a string?
* What is the hashCode() and equals() used for?
* What does the interface Serializable do? What about Parcelable in Android?
* Why are Array and ArrayList different? When would you use each?
* What’s the difference between an Integer and int?
* What is a ThreadPool? Is it better than using several β€œsimple” threads?
* What the difference between local, instance and class variables?

Mid
* What is reflection?
* What is dependency injection? Can you name a few libraries? (Have you used any?)
* What are strong, soft and weak references in Java?
* What does the keyword synchronized mean?
* Can you have β€œmemory leaks” on Java?
* Do you need to set references to null on Java/Android?
* What does it means to say that a String is immutable?
* What are transient and volatile modifiers?
* What is the finalize() method?
* How does the try{} finally{} works?
* What is the difference between instantiation and initialisation of an object?
* When is a static block run?
* Why are Generics are used in Java?
* Can you mention the design patterns you know? Which of those do you normally use?
* Can you mention some types of testing you know?

Senior
* How does Integer.parseInt() works?
* Do you know what is the β€œdouble check locking” problem?
* Do you know the difference between StringBuffer and StringBuilder?
* How is a StringBuilder implemented to avoid the immutable string allocation problem?
* What does Class.forName method do?
* What is Autoboxing and Unboxing?
* What’s the difference between an Enumeration and an Iterator?
* What is the difference between fail-fast and fail safe in Java?
* What is PermGen in Java?
* What is a Java priority queue?
* *s performance influenced by using the same number in different types: Int, Double and Float?
* What is the Java Heap?
* What is daemon thread?
* Can a dead thread be restarted?

Source: medium.
πŸ‘5❀1
πŸ•― Sites to practice programming and solve challenges to improve programming skills πŸ•―

1️⃣ https://edabit.com
2️⃣ https://codeforces.com
3️⃣ https://www.codechef.com
4️⃣ https://leetcode.com
5️⃣ https://www.codewars.com
6️⃣ http://www.pythonchallenge.com
7️⃣ https://coderbyte.com
8️⃣ https://www.codingame.com/start
9️⃣ https://www.freecodecamp.org/learn

ENJOY LEARNING πŸ‘πŸ‘
❀2
Introduction to Machine Learning (Fall 2020)
By Massachusetts Institute of Technology, MIT

Length: 13 weeks

πŸ”— Course Link

#ml #machinelearning #datascience #MIT
βž–βž–βž–βž–βž–βž–βž–βž–βž–βž–βž–βž–βž–
πŸ‘2
A bit obvious, but really useful advice

Avoid posting your cell phone number on social networks and other open sources, if you don't want to receive spam calls and SMS. Such numbers are collected by parser programs, and then used to form databases for calls and mailings.
Business Analyst Interview Questions and Answers
πŸ‘‡πŸ‘‡

1. What is analysis in tableau?

Ans: Tableau comes with inbuilt features to analyze the data plotted on a chart. We have various tools such as adding an average line to the chart which tableau calculates itself after we drop the tool on the chart. Some other features include clustering, percentages, forming bands of a particular range and various other tools to explore and inspect data. All these tools are available in analyze tab on each sheet used to create any chart. The features become visible only when they are applicable to the worksheet.


2.How to create sets in tableau?

Ans: Sets are custom fields used to compare and ask questions about a subset of data. For creating a set on dimension, right-click on a dimension in data pane and select create -> set. In general tab select the fields that will be considered for computing the set. Specify the conditions to create set in conditions tab and you also have the option to select top N members in dataset based on any field in the top tab. When a set is created it divides the measure into two parts namely in and out of the set based on the conditions applied by the user.


3.Why and how would you use a custom visual file?

A custom visual file is used when none of the pre existing visuals fit the business needs. Custom visual files are generally created by Developers which can be used in the same way as prepackaged files.


4. What are the various type of users who can use Power BI?

Ans: PowerBI can be used by anyone for their requirements but there is a particular group of users who are more likely to use it:

Report Consumers: They consume the reports based on a specific information they need

Report Analyst: Report Analysts need detailed data for their analysis from the reports

Self Service Data Analyst: They are more experienced business data users. They have an in-depth understanding of the data to work with.

Basic Data Analyst: They can build their own datasets and are experienced in PowerBI Service

Advanced Data Analyst: They know how to write SQL Queries and have hands-on experience on PowerBI. They have experience in Advanced PowerBI with DAX training and data modelling.
πŸ‘1
Data Analyst INTERVIEW QUESTIONS AND ANSWERS
πŸ‘‡πŸ‘‡

1.Can you name the wildcards in Excel?

Ans: There are 3 wildcards in Excel that can ve used in formulas.

Asterisk (*) – 0 or more characters. For example, Ex* could mean Excel, Extra, Expertise, etc.

Question mark (?) – Represents any 1 character. For example, R?ain may mean Rain or Ruin.

Tilde (~) – Used to identify a wildcard character (~, *, ?). For example, If you need to find the exact phrase India* in a list. If you use India* as the search string, you may get any word with India at the beginning followed by different characters (such as Indian, Indiana). If you have to look for India” exclusively, use ~.

Hence, the search string will be india~*. ~ is used to ensure that the spreadsheet reads the following character as is, and not as a wildcard.


2.What is cascading filter in tableau?

Ans: Cascading filters can also be understood as giving preference to a particular filter and then applying other filters on previously filtered data source. Right-click on the filter you want to use as a main filter and make sure it is set as all values in dashboard then select the subsequent filter and select only relevant values to cascade the filters. This will improve the performance of the dashboard as you have decreased the time wasted in running all the filters over complete data source.


3.What is the difference between .twb and .twbx extension?

Ans:
A .twb file contains information on all the sheets, dashboards and stories, but it won’t contain any information regarding data source. Whereas .twbx file contains all the sheets, dashboards, stories and also compressed data sources. For saving a .twbx extract needs to be performed on the data source. If we forward .twb file to someone else than they will be able to see the worksheets and dashboards but won’t be able to look into the dataset.


4.What are the various Power BI versions?

Power BI Premium capacity-based license, for example, allows users with a free license to act on content in workspaces with Premium capacity. A user with a free license can only use the Power BI service to connect to data and produce reports and dashboards in My Workspace outside of Premium capacity. They are unable to exchange material or publish it in other workspaces. To process material, a Power BI license with a free or Pro per-user license only uses a shared and restricted capacity. Users with a Power BI Pro license can only work with other Power BI Pro users if the material is stored in that shared capacity. They may consume user-generated information, post material to app workspaces, share dashboards, and subscribe to dashboards and reports. Pro users can share material with users who don’t have a Power BI Pro subscription while workspaces are at Premium capacity.

ENJOY LEARNING πŸ‘πŸ‘
Tips for Google Interview Preparation
Now that we know all about the hiring process of Google, here are a few tips which you can use to crack Google’s interview and get a job.

Understand the work culture at Google well - It is always good to understand how the company works and what are the things that are expected out of an employee at Google. This shows that you are really interested in working at Google and leaves a good impression on the interviewer as well.
Be Thorough with Data Structures and Algorithms - At Google, there is always an appreciation for good problem solvers. If you want to have a good impression on the interviewers, the best way is to prove that you have worked a lot on developing your logic structures and solving algorithmic problems. A good understanding of Data Structures and Algorithms and having one or two good projects always earn you brownie points with Amazon.
Use the STAR method to format your Response - STAR is an acronym for Situation, Task, Action, and Result. The STAR method is a structured way to respond to behavioral based interview questions. To answer a provided question using the STAR method, you start by describing the situation that was at hand, the Task which needed to be done, the action taken by you as a response to the Task, and finally the Result of the experience. It is important to think about all the details and recall everyone and everything that was involved in the situation. Let the interviewer know how much of an impact that experience had on your life and in the lives of all others who were involved. It is always a good practice to be prepared with a real-life story that you can describe using the STAR method.
Know and Describe your Strengths - Many people who interview at various companies, stay shy during the interviews and feel uncomfortable when they are asked to describe their strengths. Remember that if you do not show how good you are at the skills you know, no one will ever be able to know about the same and this might just cost you a lot. So it is okay to think about yourself and highlight your strengths properly and honestly as and when required.
Discuss with your interviewer and keep the conversation going - Remember that an interview is not a written exam and therefore even if you come up with the best of solutions for the given problems, it is not worth anything until and unless the interviewer understands what you are trying to say. Therefore, it is important to make the interviewer that he or she is also a part of the interview. Also, asking questions might always prove to be helpful during the interview.
❀2πŸ‘1