This page is a NO-INDEX summary of comments posted in this blog.
Total 849 Comments (8/34 Pages) - Newer Comments - Older Comments
176. 2019-11-05 17:36:06 Trevor Storey Comments on Comparing Left and Right Branch of a Complete Binary Tree:
Those & deals are 2 ampersands. recommend copying and pasting into an ide to be able to read...
177. 2019-11-05 17:34:18 Trevor Storey Comments on Comparing Left and Right Branch of a Complete Binary Tree:
Here's my solution that works for any length input array. Like I said, ugly, but works. care to try for a refactor?
const solution = (arr) => {
if (arr.length < 1) return "";
let leftSum = 0;
let rightSum = 0;
for (let leftStartIdx = 1, rightStartIdx = 2; leftStartIdx < arr.length && rightStartIdx < arr.length; leftStartIdx = leftStartIdx + leftStartIdx + 1, rightStartIdx = rightStartIdx + rightStartIdx + 1) {
for (let leftIdx = leftStartIdx; leftIdx < rightStartIdx; leftIdx++) {
if (arr[leftIdx] !== -1) leftSum += arr[leftIdx];
}
let nextLeftIdx = leftStartIdx + leftStartIdx + 1;
for (let rightIdx = rightStartIdx; rightIdx < nextLeftIdx && rightIdx rightSum) {
return "Left";
} else if (leftSum < rightSum) {
return "Right";
} else {
return "";
}
};
178. 2019-11-05 17:06:01 Trevor Storey Comments on Comparing Left and Right Branch of a Complete Binary Tree:
This doesn't seem to work for a longer array input...the test inputs on hired only go up to an input array length of 6. (Also, entering your own test input doesn't work on the site atm, I'm talking with support right now about it. So the only way to test is to bring the function into your own environment and run some inputs through it.)
If I understand how the function is supposed to work correctly, given an input array
[3, 6, 2, 9, -1, 10, 11, 4, 7, 8, 1, 5, 0, 0, 0]
[C,L, R, L, L, R, R, L, L, L, L, R, R, R, R]
Left = 6 + 9 + -1(0) + 4 + 7 + 8 + 1 = 35
Right = 2 + 10 + 11 + 5 + 0 + 0 + 0 = 28
Given that input, the output should be "Left", but with your solution the output is "Right".
I did come up with one solution that worked...but I submitted it and lost it 🙁 so I'll have to do it again. But it was ugly, I'm pretty sure there's a better way to do it.
179. 2019-10-28 19:35:45 bumb Comments on The experience of using Teamviewer on iPhone SE, connecting to desktop, and SSH to VPS, in order to make a Robot Python script up running.:
ohohohohohoh relly
180. 2019-10-24 22:44:51 ACMer Comments on Algorithms to Remove All Adjacent Duplicates In a String:
The expected output is "mipi" according to the test cases.
181. 2019-10-24 20:03:51 CaptainDaVinci Comments on Algorithms to Remove All Adjacent Duplicates In a String:
Your solution does not work for the following case:
mississipi
Expected output: mpi
182. 2019-10-24 17:06:42 Alex Comments on How to Analyze Website by using the Wappalyzer (Chrome Extension)?:
Wappalyzer is nice tool for identifying technologies used on websites.
183. 2019-10-19 22:31:17 Frederik Comments on C/C++ Coding Exercise - Recursive Computation of Value e:
#include
#include
#include
double factorial(double n)
{
if (n==1)
{
return 1;
}
else
{
return n*factorial(n-1);
}
}
int main()
{
double n=1;
double stop;
double e=1;
int i=2;
printf("Enter how many times you want to calculate e: \n");
scanf("%lf",&stop);
printf("e1: %.6f\n",e);
for (n=1;n<stop;n++)
{
e+=(1/factorial(n));
printf("e%d: %.6f\n",i,e);
i++;
}
184. 2019-10-03 03:11:55 John C. Comments on Fast Integer Log10:
> faster
You can't say that for sure without benchmarking. Both the binary search and chained-if methods suffer from branch misprediction, which is very far from ideal.
185. 2019-10-02 17:41:32 victor zadorozhnyy Comments on Javascript Coding Exercise: The QuickSort Implementation in Javascript:
It's not a quicksort. Looks like some kind of a merge sort (instead of two sorted arrays you have one more equal array)
In the case of quicksort you will have a median pointer and switch values inside the same array `[arr[left], arr[right]] = [arr[right], arr[left]]`
186. 2019-09-17 07:41:35 ACMer Comments on The Brace Expansion Algorithms using Breadth First Search or Depth First Search:
Good question, If there are n groups and average m elements in each group, the time complexity will be something like m^n.
187. 2019-09-17 01:45:39 Jeff Comments on The Brace Expansion Algorithms using Breadth First Search or Depth First Search:
Whats the time complexity of this problem? worst case would be something like {a,b,c}{a,b,c}{a,b,c} correct?
188. 2019-09-16 18:53:53 ACMer Comments on PHP Job Searching using Zip-Recruiter API:
I think you can contact the ziprecruiter to get a key.
189. 2019-09-16 14:36:46 scott Comments on PHP Job Searching using Zip-Recruiter API:
Any chance you could include where one can obtain the api key for this?
190. 2019-08-27 19:12:09 ACMer Comments on The Simple Video .m3u8 Downloader/Parser in PHP and Javascript:
Recursively call it? Could you give me the URL so that I can see what is wrong.
191. 2019-08-26 08:57:41 new Comments on The Simple Video .m3u8 Downloader/Parser in PHP and Javascript:
my return
Array
(
[0] => chunklist_w1863775999.m3u8
)
how to use ?
192. 2019-07-31 07:15:11 Ravindra Variagi Comments on Using COM object in NodeJS:
Is win32ole also supports macOS COM objects to access?
193. 2019-07-22 22:34:36 ACMer Comments on How to Solve 'Mobile Data Disconnected' on HTC One M9?:
Glad it helps.
194. 2019-07-22 19:05:05 fazy Comments on How to Solve 'Mobile Data Disconnected' on HTC One M9?:
My phone was not working from few days, I just changed settings as he described, I must say this man deserve appreciation. God bless you and Ton of thanks
195. 2019-07-22 15:08:03 Dave B Comments on Tutorial: Create a Sample DLL Project using CodeBlocks IDE in C/C++:
It would be good to have a worked example as to exactly how to use that simple DLL, also from within Code::Blocks. For the uninitiated, this is most certainly not simple!
I've spent hours so far, and can't figure out why I can't call that function.
196. 2019-07-19 14:31:37 Christian Cristofori Comments on A Quick Check If 32 or 64-bit OS:
This does not determine the OS architecture, this checks executable compilation architecture.
197. 2019-07-13 23:16:59 infomiasto Comments on How to Add Adsense Ads to bbPress Forum?:
It can also be done with a widget as long as the theme supports fields before and a
198. 2019-07-07 10:10:58 smestaj crna gora Comments on How to Automatically Restart MySQL Server in the event of Crash?:
did you have some script for php7.2-fpm
199. 2019-06-19 15:34:36 flambok Comments on The Hamming Distance Implementation in Javascript:
One line hamming distance in python:
def hamming_distance(s1, s2): return int(sum([c1==c2 for (c1, c2) in zip(s1, s2)]))
200. 2019-06-17 20:42:15 ACMer Comments on Algorithm to Add Two Strings Numerically in C++:
It is a bit confusing, post updated accordingly.
Newer Comments - Older Comments
–EOF (The Ultimate Computing & Technology Blog) — 46 words