问题描述
我尝试在TestDome上进行练习,以发现播放列表中是否存在重复(TestDome C++ Playlist)
我试图用这种方式解决:
bool isRepeatingPlaylist()
{
std::map<std::string,int> songs;
Song* pSong = this;
while (pSong != nullptr) {
if (songs[pSong->name] > 0)
return true;
songs[pSong->name]++;
pSong = pSong->nextSong;
}
return false;
}
反馈是我通过了4个测试用例中的3个。我没有通过的测试用例是关于性能的。你能帮我改善吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)