Skip to main content

All Questions

Filter by
Sorted by
Tagged with
4 votes
3 answers
2k views

Split function using C and dynamic memory allocation

I have programmed a function to split strings, and it gives the expected output. I am looking forward to write better code and I was told here is a good place to start. Here's my program: ...
Majd's user avatar
  • 141
1 vote
1 answer
654 views

Find out whether string A can be shifted to get string B

The task: Given two strings A and B, return whether or not A can be shifted some number of times to get B. For example, if A is abcde and B is cdeab, return true. If A is abc and B is acb, ...
thadeuszlay's user avatar
  • 4,003
2 votes
0 answers
319 views

KMP algorithm in scala

I implemented KMP pattern matching algorithm in Scala. My code works but it looks more imperative and a scala translation of C/C++ implementation. I am not able to figure out how to manage multiple ...
vikrant's user avatar
  • 405
0 votes
1 answer
533 views

Print words in decreasing order of frequency in Scala

Given a string print its words in decreasing order of frequency. Example: i/p - "aa bbb ccc aa ddd aa ccc" o/p - aa,ccc,ddd,bbb Scala: ...
vikrant's user avatar
  • 405
1 vote
1 answer
503 views

Check Is Anagram Scala HashMap based implementation

Here is the HashMap based implementation of the function checking whether two strings are anagrams: Example: ...
Vitalii Zinchenko's user avatar