# Dr.Code

Novice programmer! Love to read others codes

Showing 20 of 207 from page 1

metabox posted in #sh #script #tutorial

## [Fixed] node-gyp rebuild configure error: No Xcode or CLT version detected!

You have this error during npm install node build and you are searching about how to fix or resolve this issue. node gyp rebuild is failed, and this is because No Xcode or CLT version detected Error d

0
0
0
21

## Chocolate Game | HackerRank Problem | C++ Solution

CPP solution for hackerrank problem Chocolate Game Description Laurel and Hardy have n piles of chocolates with each pile containing some number of chocolates. The piles are arranged from left to righ

0
0
0
57

## Mandragora Forest | HackerRank Problem | Java Solution

Solution for hackerrank problem Mandragora Forest in Java. The evil forest is guarded by vicious mandragoras. Garnet and her pet must make a journey through. She starts with pet health point s and 0 e

0
0
0
20

## Convert Binary Search Tree to Doubly Linked List | Java Solution

Program to convert a binary search tree to doubly linked list with in order traversal. The left and right pointers in nodes are to be used as previous and next pointers respectively in converted Circu

0
0
0
13

metabox posted in #sql #snippets

## PostgreSQL query to return db records from the last X days, weeks or months

We always need to fetch some latest records from database and we often forget the query or too lazy to write it ourself and we search something like How to list records with date from the last 10 days

0
0
0
4

## Matching parenthesis | Google Interview Question & Solution

Here s your coding interview problem for today. This problem was asked by Google. Given a string of parentheses, write a function to compute the minimum number of parentheses to be removed to make the

0
0
0
13

## Balanced brackets | Uber Interview Question & Solution

Imagine you are building a compiler. Before running any code, the compiler must check that the parentheses in the program are balanced. Every opening bracket must have a corresponding closing bracket.

0
0
0
13

## Checking subset sum | Facebook Interview Question & Solution

This problem was asked by Facebook. Given a multiset of integers, return whether it can be partitioned into two subsets whose sums are the same. For example, given the multiset  15, 5, 20, 10, 35, 15,

0
0
0
6

## Non-decreasing Array | Facebook Interview Question & Solution

This problem was asked by Facebook. Given an array of integers, write a function to determine whether the array could become non decreasing by modifying at most 1 element. For example, given the array

0
0
0
4

## Get number using bit math operations | Facebook Interview Question & Solution

This problem was asked by Facebook. Given three 32 bit integers x, y, and b, return x if b is 1 and y if b is 0, using only mathematical or bit operations. You can assume b can only be 1 or 0. Idea be

0
0
0
5

## [Solution] Matrix-num-paths | Facebook Interview Question

This problem was asked by Facebook. There is an N by M matrix of zeroes. Given N and M, write a function to count the number of ways of starting at the top left corner and getting to the bottom right

0
0
0
10

## [Solution] Division-without-divide | Interview Question

Implement division of two positive integers without using the division, multiplication, or modulus operators. Return the quotient as an integer, ignoring the remainder. Idea behind the solution The id

0
0
0
6

## [Solution] Number of "islands" in the matrix | Amazon Interview Question

This problem was asked by Amazon. Given a matrix of 1s and 0s, return the number of islands in the matrix. A 1 represents land and 0 represents water, so an island is a group of 1s that are neighborin

0
0
0
32

## [Solution] Words-per-line | Amazon Interview Question

This problem was asked by Amazon. Given a string s and an integer k, break up the string into multiple lines such that each line has a length of k or less. You must break it up so that words don t bre

0
0
0
6

## [Solution] Implementing an LRU (Least Recently Used) cache | Google Interview Question

This problem was asked by Google. Implement an LRU Least Recently Used cache. It should be able to be initialized with a cache size n, and contain the following methods set key, value sets key to valu

0
0
0
6

## Solution for Knights Tour problem | Google Interview Question

This problem was asked by Google. A knight s tour is a sequence of moves by a knight on a chessboard such that all squares are visited once. Given N, write a function to return the number of knight s

0
0
0
9

## [Solution] Compare Tree Structure | Google Interview Question

This problem was asked by Google. Given two non empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree consists o

0
0
0
7

## [Solution] Course Dependency | Airbnb Interview Question

This problem was asked by Airbnb. We re given a hashmap associating each courseId key with a list of courseIds values, which represents that the prerequisites of courseId are courseIds. Return a sorte

0
0
0
15

## [Solution] rand5 | Two Sigma Interview Question

This problem was asked by Two Sigma. Using a function rand7  that returns an integer from 1 to 7  inclusive with uniform probability, implement a function rand5  that returns an integer from 1 to 5  i

0
0
0
68

## [Solution] max-subarray-contiguous-sum | Twitter Interview Question

This problem was recently asked by Twitter You are given an array of integers. Find the maximum sum of all possible contiguous subarrays of the array. Example 34, 50, 42, 14, 5, 86 Given this input ar

0
0
0
12