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

metabox posted in #c #cpp #codingchallenge #hackerrank-solutions

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

metabox posted in #java #codingchallenge #hackerrank-solutions #hackerrankproblem

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

metabox posted in #java #codingchallenge #data-structures #binary-search #binary-tree

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

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

metabox posted in #java #codingchallenge #google #interviewquestion

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

metabox posted in #java #codingchallenge #interviewquestion #uber

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.

metabox posted in #java #codingchallenge #facebook #interviewquestion

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,

metabox posted in #java #codingchallenge #interviewquestion #facebook

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

metabox posted in #java #codingchallenge #interviewquestion #facebook

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

metabox posted in #javascript #codingchallenge #interviewquestion #facebook

[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

metabox posted in #javascript #codingchallenge #interviewquestion

[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

metabox posted in #java #codingchallenge #interviewquestion #amazon

[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

metabox posted in #javascript #codingchallenge #interviewquestion #amazon

[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

metabox posted in #javascript #codingchallenge #interviewquestion #google

[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

metabox posted in #codingchallenge #javascript #interviewquestion #google

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

metabox posted in #java #codingchallenge #binary-tree #interviewquestion #google

[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

metabox posted in #java #codingchallenge #interviewquestion

[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

metabox posted in #java #codingchallenge #interviewquestion

[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

metabox posted in #javascript #twitter #codingchallenge #interviewquestion

[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