r/dailyprogrammer • u/rya11111 3 1 • Feb 27 '12
[2/27/2012] Challenge #16 [easy]
Hi folks! We are in the midst of discussing how this subreddit will go about but for now how about we just concentrate on challenges!
Write a function that takes two strings and removes from the first string any character that appears in the second string. For instance, if the first string is “Daily Programmer” and the second string is “aeiou ” the result is “DlyPrgrmmr”.
note: the second string has [space] so the space between "Daily Programmer" is removed
edit: if anyone has any suggestions for the subreddit, kindly post it in the feedback thread posted a day before. It will be easier to assess. Thank you.
8
u/Steve132 0 1 Feb 27 '12
So, my suggestion honestly is to remove the date and numbering in the title. That way, people can make submissions anytime they want without coordinating with the mods to get the right numbering. The approximate skill level can remain, and maybe instead of just "Challenge' a small summary can be made.
I know that I've wanted to submit several small little challenges, but messaging the mods to get the numbering scheme lined up was more effort than it was worth. Furthermore, finding a given number and date is next to impossible because the position on the page is dictated by upvotes not date submitted. For example, I think that this post, instead of [2/27/2012] #16 [easy] doesn't actually tell me anything about the thread to inspire me to click on it to see if the problem interests me, it implies that I have to do it on a particular day or that its the only problem on a particular day, and it tells me that its #16, which is largely meaningless considering there are 3 #16s (or more) per day.
Instead, today could be titled "string removal [easy]", and I could submit a different problem today, like (Wavelet Transform [hard]) without messing up the date and numbering scheme. People who are curious what the WT is could click it, but if they are bored with string transformations they could ignore the other one. Interesting problems would automatically bubble to the top with upvotes, but would fade off the frontpage with age, which is really exactly what you want anyway.
If you made those changes, I know that I would contribute new problems sometimes.
Anyway, here is my solution (C++0x)
4
u/[deleted] Feb 27 '12
Perl.
3
u/turboemu Feb 27 '12
Java:
http://pastebin.com/vN42Ycsf
2
u/eruonna Feb 27 '12
Haskell:
2
u/gjwebber 0 0 Feb 27 '12
Here's my attempt using c#:
2
u/namekuseijin Feb 27 '12
R6RS scheme:
2
u/StorkBaby 0 0 Feb 28 '12
Python, after importing the string module.
1
u/cooper6581 Feb 27 '12
C:
1
u/HobbesianByChoice Feb 27 '12
JavaScript
1
u/southof40 Feb 28 '12
Python:
The first one, foo, meets all the specs. The second, bar, makes use of sets (which I like doing) but doesn't actually do exacty what's asked for !
1
u/sylarisbest Feb 28 '12
C++ :
1
u/school_throwaway Feb 28 '12
1
u/stevelosh Feb 28 '12
Clojure:
1
u/stevelosh Feb 28 '12
Bash or Zsh:
1
u/codelahoma Mar 02 '12
CoffeeScript, regex version:
CoffeeScript, comprehension version:
1
u/Sarah132 Mar 02 '12
C++
1
u/robin-gvx 0 2 Mar 02 '12
Déjà Vu: http://hastebin.com/raw/yihiwujuva
1
u/garslo Mar 03 '12
Common Lisp:
1
u/Devanon Mar 04 '12
Learning Ruby, so this is my program
Feel free to improve it or say what is wrong :)
1
u/Yuushi Mar 14 '12
(Inefficient) Haskell:
1
u/emcoffey3 0 0 May 05 '12
C#
1
u/ragtag_creature Dec 14 '22
R
1
u/murdockit Feb 27 '12
A simple ruby solution
-1
u/namekuseijin Feb 28 '12
It's amazing how when asked to implement something, people will just use a builtin function.
0
u/kirk_o Feb 28 '12
C++
0
u/[deleted] Feb 27 '12
[deleted] — view deleted comment