Remove distracting text, extract the programming question, provide simple, common, and optimized Java solution for it.

Problem List
0
Debugging...
Run
Submit
00:00:00
Description
Editorial
Editorial
Solutions
Solutions
Submissions
Submissions
Code
Note
Note
Testcase
Testcase
Test Result
187. Repeated DNA Sequences
Medium
Topics
Companies

The DNA sequence is composed of a series of nucleotides abbreviated as 'A', 'C', 'G', and 'T'.

For example, "ACGAATTCCG" is a DNA sequence.

When studying DNA, it is useful to identify repeated sequences within the DNA.

Given a string s that represents a DNA sequence, return all the 10-letter-long sequences (substrings) that occur more than once in a DNA molecule. You may return the answer in any order.

 

Example 1:

Input: s = "AAAAACCCCCAAAAACCCCCCAAAAAGGGTTT"
Output: ["AAAAACCCCC","CCCCCAAAAA"]


Example 2:

Input: s = "AAAAAAAAAAAAA"
Output: ["AAAAAAAAAA"]


 

Constraints:

1 <= s.length <= 105
s[i] is either 'A', 'C', 'G', or 'T'.
Seen this question in a real interview before?
1/5
Yes
No
Accepted
407.2K
Submissions
816.2K
Acceptance Rate
49.9%
Topics
Hash Table
String
Bit Manipulation
Sliding Window
Rolling Hash
Hash Function
Companies
0 - 3 months
Amazon
3
0 - 6 months
LinkedIn
2
6 months ago
Google
5
Microsoft
4
Grammarly
4
Bloomberg
3
Yahoo
3
Meta
2
J.P. Morgan
2
Adobe
2
Apple
2
Atlassian
2
Discussion (46)
Choose a type
Preview
Comment
💡 Discussion Rules

1. Please don't post any solutions in this discussion.

2. The problem discussion is for asking questions about the problem or for sharing tips - anything except for solutions.

3. If you'd like to share your solution for feedback and ideas, please head to the solutions tab and post it there.

Sort by:Best
No comments yet.
1
2
3
4
5
Copyright ©️ 2024 LeetCode All rights reserved
3.4K
46
Java
Auto
1
2
3
4
5
class Solution {
    public List<String> findRepeatedDnaSequences(String s) {
        
    }
}
Restored from local
Ln 1, Col 1
You must run your code first

Paint House - LeetCode

Problem List
Tag
113. Path Sum II

Med.

114. Flatten Binary Tree to Linked List

Med.

115. Distinct Subsequences

Hard

116. Populating Next Right Pointers in Each Node

Med.

117. Populating Next Right Pointers in Each Node II

Med.

118. Pascal's Triangle

Easy

119. Pascal's Triangle II

Easy

120. Triangle

Med.

121. Best Time to Buy and Sell Stock

Easy

122. Best Time to Buy and Sell Stock II

Med.

123. Best Time to Buy and Sell Stock III

Hard

124. Binary Tree Maximum Path Sum

Hard

125. Valid Palindrome

Easy

126. Word Ladder II

Hard

127. Word Ladder

Hard

128. Longest Consecutive Sequence

Med.

129. Sum Root to Leaf Numbers

Med.

130. Surrounded Regions

Med.

131. Palindrome Partitioning

Med.

132. Palindrome Partitioning II

Hard

133. Clone Graph

Med.

134. Gas Station

Med.

135. Candy

Hard

136. Single Number

Easy

137. Single Number II

Med.

138. Copy List with Random Pointer

Med.

139. Word Break

Med.

140. Word Break II

Hard

141. Linked List Cycle

Easy

142. Linked List Cycle II

Med.

143. Reorder List

Med.

144. Binary Tree Preorder Traversal

Easy

145. Binary Tree Postorder Traversal

Easy

146. LRU Cache

Med.

147. Insertion Sort List

Med.

148. Sort List

Med.

149. Max Points on a Line

Hard

150. Evaluate Reverse Polish Notation

Med.

151. Reverse Words in a String

Med.

152. Maximum Product Subarray

Med.

153. Find Minimum in Rotated Sorted Array

Med.

154. Find Minimum in Rotated Sorted Array II

Hard

155. Min Stack

Med.

156. Binary Tree Upside Down

Med.

157. Read N Characters Given Read4

Easy

158. Read N Characters Given read4 II - Call Multiple Times

Hard

159. Longest Substring with At Most Two Distinct Characters

Med.

160. Intersection of Two Linked Lists

Easy

161. One Edit Distance

Med.

162. Find Peak Element

Med.

163. Missing Ranges

Easy

164. Maximum Gap

Med.

165. Compare Version Numbers

Med.

166. Fraction to Recurring Decimal

Med.

167. Two Sum II - Input Array Is Sorted

Med.

168. Excel Sheet Column Title

Easy

169. Majority Element

Easy

170. Two Sum III - Data structure design

Easy

171. Excel Sheet Column Number

Easy

172. Factorial Trailing Zeroes

Med.

173. Binary Search Tree Iterator

Med.

174. Dungeon Game

Hard

175. Combine Two Tables

Easy

176. Second Highest Salary

Med.

177. Nth Highest Salary

Med.

178. Rank Scores

Med.

179. Largest Number

Med.

180. Consecutive Numbers

Med.

181. Employees Earning More Than Their Managers

Easy

182. Duplicate Emails

Easy

183. Customers Who Never Order

Easy

184. Department Highest Salary

Med.

185. Department Top Three Salaries

Hard

186. Reverse Words in a String II

Med.

187. Repeated DNA Sequences

Med.

188. Best Time to Buy and Sell Stock IV

Hard

189. Rotate Array

Med.

190. Reverse Bits

Easy

191. Number of 1 Bits

Easy

192. Word Frequency

Med.

193. Valid Phone Numbers

Easy

194. Transpose File

Med.

195. Tenth Line

Easy

196. Delete Duplicate Emails

Easy

197. Rising Temperature

Easy

198. House Robber

Med.

199. Binary Tree Right Side View

Med.

200. Number of Islands

Med.

201. Bitwise AND of Numbers Range

Med.

202. Happy Number

Easy

203. Remove Linked List Elements

Easy

204. Count Primes

Med.

205. Isomorphic Strings

Easy

206. Reverse Linked List

Easy

207. Course Schedule

Med.

208. Implement Trie (Prefix Tree)

Med.

209. Minimum Size Subarray Sum

Med.

210. Course Schedule II

Med.

211. Design Add and Search Words Data Structure

Med.

212. Word Search II

Hard

213. House Robber II

Med.

214. Shortest Palindrome

Hard

215. Kth Largest Element in an Array

Med.

216. Combination Sum III

Med.

217. Contains Duplicate

Easy

218. The Skyline Problem

Hard

219. Contains Duplicate II

Easy

220. Contains Duplicate III

Hard

221. Maximal Square

Med.

222. Count Complete Tree Nodes

Easy

223. Rectangle Area

Med.

224. Basic Calculator

Hard

225. Implement Stack using Queues

Easy

226. Invert Binary Tree

Easy

227. Basic Calculator II

Med.

228. Summary Ranges

Easy

229. Majority Element II

Med.

230. Kth Smallest Element in a BST

Med.

231. Power of Two

Easy

232. Implement Queue using Stacks

Easy

233. Number of Digit One

Hard

234. Palindrome Linked List

Easy

235. Lowest Common Ancestor of a Binary Search Tree

Med.

236. Lowest Common Ancestor of a Binary Tree

Med.

237. Delete Node in a Linked List

Med.

238. Product of Array Except Self

Med.

239. Sliding Window Maximum

Hard

240. Search a 2D Matrix II

Med.

241. Different Ways to Add Parentheses

Med.

242. Valid Anagram

Easy

243. Shortest Word Distance

Easy

244. Shortest Word Distance II

Med.

245. Shortest Word Distance III

Med.

246. Strobogrammatic Number

Easy

247. Strobogrammatic Number II

Med.

248. Strobogrammatic Number III

Hard

249. Group Shifted Strings

Med.

250. Count Univalue Subtrees

Med.

251. Flatten 2D Vector

Med.

252. Meeting Rooms

Easy

253. Meeting Rooms II

Med.

254. Factor Combinations

Med.

255. Verify Preorder Sequence in Binary Search Tree

Med.

256. Paint House

Med.

257. Binary Tree Paths

Easy

258. Add Digits

Easy

259. 3Sum Smaller

Med.

260. Single Number III

Med.

261. Graph Valid Tree

Med.

262. Trips and Users

Hard