“I’d always known that if I could get the right deal, I would take it,” she said. “But I wouldn’t have gotten this kind of deal six months ago.” It’s a deal that pays less than what Amazon, in partnership with Houghton Mifflin Harcourt, bid, but there were doubts about whether the big bookstore chains would carry a book published by their competitor. (Also, Hocking says, Amazon wanted to restrict e-book rights to the Kindle and offered a lower rate of royalties than she often gets from what has been self-published.) And Hocking wants to reach as many people as possible among the 85 percent or so of the population who don’t have e-readers yet. “For me to be a billion-dollar author,” she would tell me later, “I need to have people buying my books at Wal-Mart.”

Hocking took a bite of a chocolate and looked at Goldman, who also works as her assistant. “Get my mom on the phone,” she said. “Tell her I got flowers. She’ll freak out.”

Hocking, who is 26, comes across as a hipster schoolgirl. The first day we met, she wore a Teenage Mutant Ninja Turtles T-shirt, jeans, a giant glittery dime-store frog ring and no shoes, revealing her electric-blue toenails. She was living in a home the size of a modest Manhattan one-bedroom. Its porch was decorated with a plastic pink flamingo and little pink-flamingo-shaped Christmas lights.

Hocking gave a self-deprecating tour. In the kitchen, she pointed out a hole in the ceiling that her cats, Squeak and Nikki, like to crawl up into so they can nap in the eaves. In her office there was a framed check from Amazon for $15.75 for her first royalties, from a year ago. When we settled down in her living room, Hocking described what was, for someone who becomes a writer, a not-unfamiliar childhood. “I was seriously depressed for most of my life,” she said. She channeled her feelings into fan fiction. “A lot of stuff I did was different takes on ‘Star Wars’ and ‘Labyrinth.’ I was going to end up with Luke Skywalker and stuff.” What was unusual, however, was her age: she started writing, or at least telling stories, at 3 or 4. “I remember one when I was 8 or 9. It was about a girl and a leopard who rescued people. They were like a duo.” (The plot of “Hollowland” involves a girl and a lion helping people escape the zombie apocalypse.) At 11, her parents separated, and when she got a computer that year, she said, “that was like the biggest lifesaver ever.”

High school was rough, though not outlandishly so. “She says no one remembers her today, but she was in the punk-arty group,” said Goldman, to whom she has referred on her blog as “my platonic life mate.” Hocking was also a bit of a loner, Goldman added. “She would always be home writing when people were hanging out.”

By the time she was 17, Hocking had completed her first novel, “Dreams I Can’t Remember,” which she sent to every agent she could find through Google and “Writer’s Market.” All of them — “about 50,” she said — rejected her, mostly with form letters. Today she doesn’t think the agents made a mistake, and blames her query letter as much as the work itself. “I was whiny and depressed and thought life was going to be handed to me.”

She kept at it, intermittently. She also worked as a dishwasher at Oriental Express, watched her B.F.F. fall in love, dated a bad boy. “He was in a band with some friends of mine — what instrument did he play?” she asked Goldman.