# Tag Info

3

using namespace std; is a bad practice. The code is plain C. You have two options: Admit this fact, change your #includes to the C-style, and declare your functions as extern "C". This way they are callable from both C and C++ code. Make a class, and overload operator[](std::size_t) and operator[](std::size_t) const. The width shall be a class ...

3

I don't think there is a logic error in what you have posted. And even though there are details that would make it nicer (the cycle can for example run from i=1, questionable use of bits/stdc++.h header, long variable scopes and similar), it should do its job. I suggest to think about time complexity of the algorithm. Your brute force approach will have ...

3

concatenate There is no need to do the concatenation pairwise np.concatenate([img[:, :, :, i][0] for i in range(img.shape[-1])]) should improve the speed already numpy.moveaxis You can use numpy.moveaxis new_array2 = np.concatenate(np.moveaxis(img[0],(0,1,2), (1,2,0))) To check whether the result is the same: assert np.array_equal(new_array, new_array2)...

2

Overall, a solid effort. You've already listed the major areas for improvement. Switch from arrays to Lists to use the built-in sort method. Change the game loop to include a menu option to quit mid-game. Validate the input. Now for my comments. The convention is that class names in Java start with a capital letter. The ceeLo class should be named CeeLo....

2

well, your code looks fine, but there are few things I would like to talk about. The class names allways goes using UpperCamelCase, at least in Java it is very common. Usually we have the parameter name equally named to the class attribute: void setName(String pname) { name = pname;//you should not. plus your IDE may have getters/setters generator } //...

2

The way your loops are organized results in an unpleasant phenomenon. Namely, you process the same subsequence many times. Let's say, a long good range starts at the index k and has a length n. The inner loop finds it. Then the next iteration of the outer loop starts processing it again, this time from index k + 1. Then from index k+2, etc. It will take $O(... 2 The suggested code might be considered better because it has less duplicate code. In this case most of the HTML strings are duplicated in your first example. Code with less duplication is less work and less error prone to change. For example, if the classes for the outer div needed to be changed, then in your example you would have to change two places ... 1 I don't know enough about the shape of testData to write great code, but you could preprocess and convert testData from an array to an object or Map of key-value pairs. By using the first element of each item in testData as the key, then you can convert your$O(n)$inner "search" loop into a constant time$O(1)\$key lookup. This would reduce ... 1 This reminds me of a Battleship gameboard parser that I once designed. https://stackoverflow.com/a/47595575/2943403 a rare case where regex outperforms non-regex techniques. I am going to recommend a class variable that is an associative array so that variable variables can be avoided. By filling each subarray with the respective$result strings, you ...

Only top voted, non community-wiki answers of a minimum length are eligible