All Questions
127 questions
8
votes
3
answers
1k
views
Dynamic Arrays with Count / Capacity in C
I write in C for several projects (e.g. learning / teaching,
coding competitions, data processing) and frequently need
arrays (e.g. strings) with fast appending / concatenation / reversing.
I've ...
6
votes
4
answers
2k
views
Automate character search in C
THE TASK
We are dealing with a string of symbols and need quick responses to queries of the following types:
What is the position of the k-th occurrence of symbol X in the string?
Reading from ...
2
votes
1
answer
64
views
JS animated string builder
Today, I tried to write a simple function that would display the characters of my string one by one by iterating over a string containing the letters of the alphabet and showing the steps on the ...
0
votes
1
answer
1k
views
How to split a file with multiple lines into fractional array elements?
I have a file with content:
4;10;3;6;10
6;9;1;3;5
3;2;1;1;2,65
I need to split each line of the file into an fractional (double) array with elements as these ...
6
votes
1
answer
460
views
Fastest function to `Remove Duplicate Lines` per each cell
The below function is used to Remove Duplicate Lines per each cell.
It works without problem, but it is slow with a range of only one column and 17k rows.
Actually, ...
3
votes
1
answer
137
views
String / Char Vector Concatenation Performance Comparison in Matlab
Considering the suggestion of using modern string arrays instead of char vectors proposed by Cris Luengo, I am trying to make a code snippet for performance comparison of these two cases.
The ...
1
vote
1
answer
2k
views
Integer array to string
This function creates takes an int * buffer and creates a neatly formatted string (useful for printing the contents of an array).
Is the code easy to follow?
Is it ...
5
votes
3
answers
1k
views
FizzBuzz, but with provided start and end of sequence, results stored in array, and a separate function to convert integers to strings
To learn C, I'm doing the traditional FizzBuzz challenge with extra restrictions:
The start and end of sequence is provided by the user
Instead of directly printing the results, the results must be ...
1
vote
1
answer
46
views
Convert string to object array javascript
I want to convert string to object array. Suppose I have following string.
const str = "someValue,display";
I want to convert it like following.
...
3
votes
1
answer
370
views
Grouping anagrams together from a string array
I wrote this code in c#. It is a question from LeetCode, number 49. Given an array of strings, group the anagrams.
The examples it gives are:
["eat","tea","tan","...
7
votes
1
answer
346
views
Create tweet threads from String in Java
I recently got this question in an exam, this is how I implemented, it is working fine. However, I would like to know if the code can be improved, as I think it for sure needs to be improved. The ...
10
votes
4
answers
3k
views
First non-repeating Character, with a single loop in Python
I recently tried to solve the first non-repeating character problem. Please tell me if my solution is valid. I'm aiming for O(n) with a single loop.
My thinking is, it would be easy to tell you what ...
1
vote
2
answers
102
views
Check URL for keywords [closed]
I'm looking at improving my PHP knowledge and wondering if anybody has any tips on improving and optimising my function below?
...
2
votes
1
answer
145
views
Go Lang custom convert array into string with two separators
This is my custom function to join strings from an array into one string.
We can provide normal separator and the last one. ...
3
votes
3
answers
175
views
C string parser criticism
I have written a program to parse a string depending on the string the user provides.
Any advise/criticism is appreciated.
...