#include<iostream> using namespace std; // A recursive binary search function. It returns // location of x in given array arr[l..r] is present, // otherwise -1 int binarySearch(int arr[], int l, …
Monthly Archives
November 2020
-
-
-
Interview
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target
by dnaadminby dnaadminHere is a brute force solution: #include <iostream> #include <vector> using namespace std; class Solution { public: vector<int> twoSum(vector<int>& nums, int target) { int n = nums.size(); for (int i=0;i<n;++i) …
-
-
-
-
Interview
Determining if a particular string has all unique characters (in C++)
by dnaadminby dnaadmin#include <string> #include <vector> #include <iostream> #include <bitset> using namespace std; bool isUniqueChars(const string &str){ if (str.length() > 128){ return false; } vector<bool> char_set(128); for (int i = 0; i …
-
Wireshark is a free and open-source packet analyzer. It is used for network troubleshooting, analysis, software and communications protocol development, and education. Originally named Ethereal, the project was renamed Wireshark …
-
-
