Skip to main content

All Questions

Tagged with
4 votes
4 answers
398 views

Finding Special Parts in a Word

Task description: Imagine you have a long word made up of small letters like "a", "b", "c", ancd so on. Let’s call this word a puzzle word. We want to look at all the ...
CodeCrusader's user avatar
7 votes
3 answers
990 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 ...
Justin Chang's user avatar
  • 2,437
6 votes
1 answer
392 views

C++ program to format byte sequences into Python like string representations

This is a C++ program I wrote, that includes functions to convert integers to byte sequences in little endian or big endian order, and functions to convert a byte sequence to a string representation. ...
Ξένη Γήινος's user avatar
3 votes
1 answer
126 views

Read a line from a stream

Since the standard fgets() does not suffice for my use cases, as it doesn't automatically enlarge the target buffer if needed, and ...
Madagascar's user avatar
  • 10.1k
1 vote
1 answer
236 views

Function that finds the exact number of times a string appears in a text

So I was tasked with providing a function that returns how many exact occurrences of attribute word appear in attribute text. The goal is for the function to be as fast as possible, and I managed to ...
Jules Raschilas's user avatar
4 votes
3 answers
855 views

Codewars: Multiplying Polynomials

I'm trying to solve the following Kata from Codewars in Python. My code produces the desired result for all the tests, yet it is not optimal, so it takes too much time to accomplish the big tests. <...
GuntherOnFire's user avatar
5 votes
1 answer
273 views

string_view tokenizer function template

Below is a function template that tokenizes a given std::basic_string_view using a given delimiter and assigns the tokens to a buffer (via a ...
digito_evo's user avatar
4 votes
4 answers
2k views

Matching words from a text with a big list of keywords in Python

I implemented the following code to retrieve medication names from a given text (prescription_text in the code). It works by matching words in the text with a list ...
cuzureau's user avatar
  • 181
7 votes
1 answer
2k views

String literals concatenation with support for dynamic strings

I have implemented a function to concatenate string literals at compile time. Basic requirements: Very simple API. Can be used as a one-liner. Must accept variadic string literals. Highly optimized ...
Sergey Kolesnik's user avatar
1 vote
2 answers
321 views

Replacing banned words from a given text

The following algorithm is used to find a word from Blacklisted words in a string (called text) and replace these words with censored text, as shown in the example. Example: ...
TomaszOleszko's user avatar
2 votes
1 answer
83 views

Optimising function to strip honorifics from names

Problem I have a list of around ~1000 honorifics, see below for a sample. Given an input string of a name, for example ...
Ian's user avatar
  • 233
5 votes
4 answers
2k views

StringPool in C++

I wrote a simple string pool for my compiler in C++ and want to hear your thoughts on its design. String pool has 2 functions: intern and ...
gavrilikhin.d's user avatar
11 votes
3 answers
2k views

Remove leading zeroes from the beginning of a string

I want to remove leading zeroes (for a big integer library I'm currently making) in numbers represented as char arrays. I chose assembly for speed, but in order to simplify making the algorithm and ...
avighnac's user avatar
  • 331
4 votes
1 answer
4k views

TypeScript function to compare two arrays while ignoring case and whitespace

I'm just looking for general guidance on this short TypeScript function I implemented. Are there any glaring violations? Are there better practices for accomplishing this? Should I be using map/reduce/...
Bob Horn's user avatar
  • 213
5 votes
3 answers
8k views

Discussing approaches for converting Enum to String

I need to convert the ENUM to a respective string value for which I came up with two approaches and I'm trying to see why would a second approach be better than the first one if even in terms of ...
xyf's user avatar
  • 508

15 30 50 per page
1
2 3 4 5
25